-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(vue3): 支持vue3类组件 #11436
feat(vue3): 支持vue3类组件 #11436
Conversation
@agileago 麻烦提供一下修复前使用类组件失败的 demo |
@agileago 原来是有这么一个属性,难怪我用 vue-class-component 测试没有问题,学习了~ 麻烦 taro 根目录运行一下 |
@Chen-jj mac air m1 跑不起来... 我到公司弄 |
vue-class-component 弃坑了吧,好久都没人维护了 vuejs/vue-class-component#569 |
@Chen-jj ok了 |
@agileago 666~感谢贡献 |
@Chen-jj VUE3文档里面有个限制应该可以解除 这个其实就是相当于 // 处理forwardref
export function useForwardRef() {
const instance = getCurrentInstance()!
function forwardRef(ref: any) {
instance.exposed = ref
instance.exposeProxy = ref
}
return forwardRef
}
// 这是 vue3中包装组件
export default function createComponent (name, classNames = []) {
return {
emits: ['tap'],
setup (props, { slots, emit, attrs }) {
const forwardRef = useForwardRef()
return () => (
h(
`${name}-core`,
{
ref: forwardRef,
class: ['hydrated', ...classNames],
onClick (e) {
emit('tap', e)
}
},
slots
)
)
}
}
} |
@Chen-jj 没看到? |
@agileago 学习了~ 有空的话可以另外提个 PR 哈~ |
好的,我怕这是 breakchange, 不知道你merge不 |
合的,breaking changes 跟 minor 版本发布哈 |
ok |
这个 PR 做了什么? (简要描述所做更改)
支持vue3类组件
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台: