Vue 数据流最佳实践:nuxt vue graphql apollo (maybe no vuex)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- graphql, javascript, nuxt
- Domain
- frontend
Research direction
Start by reviewing the pages/xxx apollo.js and components.js examples, then trace how Nuxt fetch and asyncData handle Apollo data during SSR. Compare the proposed mutation inputs, query placement, fragments, and route variables. The issue does not define a specific implementation or acceptance criteria, so completion would require an agreed-upon data-flow design.
Written by the indexing model from the issue text.
Description
graphql mutation 要以input为入参
pages/xxx apollo.js components.js
query就该离得最近, 子组件也由自己去取
或者就使用fragememts吧,如果想合并请求,或者是考虑page route 入参
SSR渲染,只可能发生在fetch或者async data,但是这样的话 apollo怎么到data呢?
::: tip You have access to this in options like variables, even on the server! :::
import gql from 'fraql'
export default {
name: 'PDP',
components: {
productDetail,
pdpAppealTo,
swiper,
swiperSlide,
recommendProduct,
MoreBrandProduct,
GuestYouLink,
RecommendPopup,
lazyImg,
LittleRedBook,
},
data() {
return {
sku: null,
selectedOptions: {},
lowStock: false,
sellOut: false,
offSheld: false,
skuOff: false,
show: true,
brand: '',
lodingImage: true,
imageList: [],
}
},
apollo: {
name: gql`{
shop {
name
}
}
`,
detail: {
query: gql`
query productDetail($codes: [String!]!) {
shop {
bffSpusByCodes(codes: $codes) {
type
preSaleAttribute {
startTime
endTime
scheduledDeliveryTime
}
spu {
isPreSale
id
seo {
seoTitle
seoKeywords
seoDescription
}
code
promotions {
name
label
description
ruleDesc
id
beginTime
endTime
gifts{
name
number
}
}
title
onShelves
productType
brand {
imageUrl
code
name
description
}
categories {
name
code
path
}
images {
url
}
subTitle
description
inventory
sales
skus {
id
code
isEnabled
inventory
featuredType
activityPrice {
promotionPrice {
amount
currencyCode
}
}
promotions {
name
label
activityType
promotionScope
description
ruleDesc
id
beginTime
endTime
gifts{
name
number
}
}
salePrice {
amount
currencyCode
}
listPrice {
amount
currencyCode
}
options {
code
frontName
value {
code
frontName
displayName
images {
url
}
thumbnails {
url
}
}
}
preDays
}
bffSkus {
isWish
sku {
id
code
isEnabled
inventory
featuredType
activityPrice {
promotionPrice {
amount
currencyCode
}
}
promotions {
name
label
activityType
promotionScope
description
id
beginTime
endTime
gifts{
name
number
}
}
salePrice {
amount
currencyCode
}
listPrice {
amount
currencyCode
}
options {
code
frontName
value {
code
frontName
displayName
images {
url
}
}
}
preDays
}
}
listPrice {
currencyCode
amount
}
salePrice {
currencyCode
amount
}
options {
code
frontName
values {
code
url
displayName
images {
url
}
thumbnails{
url
}
}
}
attributes {
code
frontName
values {
url
displayName
}
}
}
}
}
}
`,
variables() {
return { codes: [this.productId] }
},
},
},
- Dominant language
- No language data
- Stars
- 730
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JimmyLv/jimmylv.github.io
-
如何将我的RSS源打包成商品售卖?Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
JimmyLv/jimmylv.github.io#399 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
JimmyLv/jimmylv.github.io#398 · 16 comments · 1 reaction ·
-
有哪些有趣的 AI 新产品?Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
JimmyLv/jimmylv.github.io#397 · 27 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
JimmyLv/jimmylv.github.io#396 ·
-
如何正确地休息?Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
JimmyLv/jimmylv.github.io#392 ·
All issues in JimmyLv/jimmylv.github.io
Similar issues
-
bug role: dev-lead
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
briangwalker/TrussExplorer#424 ·
Maintainers usually reply within 1 day
-
Improve DB UIOpenenhancement ui/ux
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
jbigler/railswitch#222 ·
Maintainers usually reply within 1 day
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-webui/open-webui#34329 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
be-BOP-io-SA/be-BOP#2848 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100