vuejs / docs

📄 Documentation for Vue 3

Home Page:https://vuejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setup 使用extends 生产环境报错,文档写的是不建议

qiaokeli111 opened this issue · comments

"vue": "^3.3.11"
“vite”:"5.0.8"

开发环境与生产环境的qq.setup(props, ctx)不一致,开发环境返回对象可以正常使用,生产环境返回函数无法进行修改

import qq from "./qq.vue";
var se = {
extends: qq,
setup(props, ctx) {
return qq.setup(props, ctx)
},
}
期望把 此段文档进行修改
1713516282368

开发环境返回对象可以正常使用,生产环境返回函数无法进行修改

Can you explain what are you trying to do, preferably with code that works in dev but not in prod?

开发环境返回对象可以正常使用,生产环境返回函数无法进行修改

Can you explain what are you trying to do, preferably with code that works in dev but not in prod?

Okay, let me give a simple example
import Base from './Base.vue'
export default {
extends: Base,
setup(props, ctx) {
return {
...Base.setup(props, ctx),
// 本地绑定
}
}
}
This is an official document example for Vue,I just changed the .js suffix of base to .vue
This code can be used in the development environment, but there may be issues in the production environment
Because the setup function in the production environment returns a function that cannot be used ... To convert

For issues related to the Chinese docs site, please create issues at the official repo https://github.com/vuejs-translations/docs-zh-cn. Thank you!

Ah, it's an issue with English docs too. Probably needs just a note that it won't work with .vue files. (That snippet currently works in dev for SFCs, but not in prod.)

Ah, it's an issue with English docs too. Probably needs just a note that it won't work with .vue files. (That snippet currently works in dev for SFCs, but not in prod.)
you are right, Both English and Chinese documents have this issue,all need change