【发布时间】:2021-09-17 10:16:28
【问题描述】:
我正在开发一个 Angular 应用程序,并且我使用 axios 进行了这样的查询,由于分页大小,我想让 first 参数动态:
await axios({
url: process.env.SHOPIFY_STORE_URL,
method: 'post',
data: {
query: `
query ($pieces: Int) {
products(first: $pieces) {
edges {
node {
id
description
title
storefrontId
productType
totalInventory
tracksInventory
isGiftCard
priceRangeV2 {
minVariantPrice {
amount
currencyCode
}
maxVariantPrice {
amount
currencyCode
}
}
}
}
}
}
`,
variables: {
pieces: this.first,
}
},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Shopify-Access-Token': process.env.SHOPIFY_PASSWORD,
},
}).then((result) => {...}
如果我执行它,传递一个变量,我会得到一个回复说you must provide one of first or last。
是因为 first 必须是固定值还是什么?
【问题讨论】: