<Box
v-bind="{
title: 'Vue',
name: '---'
}">
</Box>
- 发布:2022-06-22 18:09
- 更新:2022-06-23 14:41
- 阅读:1913
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows10 18363.1556
HBuilderX版本号: 3.4.17
第三方开发者工具版本号: 1.05.2204250
基础库版本号: 2.24.6
项目创建方式: CLI
CLI版本号: 3.0
示例代码:
操作步骤:
<Box
v-bind="{
title: 'Vue',
name: '---'
}">
</Box>
不支持v-bind
<Box
v-bind="{
title: 'Vue',
name: '---'
}">
</Box>
不支持v-bind
预期结果:
正常渲染
正常渲染
实际结果:
报错
[plugin:vite:vue] unknown directive{"type":7,"name":"bind","exp":{"type":4,"loc":{"source":"","start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":1,"offset":0}},"content":"a","isStatic":false,"constType":0},"modifiers":[],"loc":{"start":{"column":5,"line":4,"offset":42},"end":{"column":19,"line":4,"offset":56},"source":"v-bind=\"props\""}}
报错
[plugin:vite:vue] unknown directive{"type":7,"name":"bind","exp":{"type":4,"loc":{"source":"","start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":1,"offset":0}},"content":"a","isStatic":false,"constType":0},"modifiers":[],"loc":{"start":{"column":5,"line":4,"offset":42},"end":{"column":19,"line":4,"offset":56},"source":"v-bind=\"props\""}}
bug描述:
<Box
v-bind="{
title: 'Vue',
name: '---'
}">
</Box>
使用cli创建的Vite+Vue3 不支持v-bind写法,报以下错误:
[plugin:vite:vue] unknown directive{"type":7,"name":"bind","exp":{"type":4,"loc":{"source":"","start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":1,"offset":0}},"content":"a","isStatic":false,"constType":0},"modifiers":[],"loc":{"start":{"column":5,"line":4,"offset":42},"end":{"column":19,"line":4,"offset":56},"source":"v-bind=\"props\""}}
vite-plugin-uni已经是最新版
"@dcloudio/vite-plugin-uni": "^3.0.0-alpha-3050020220622002",
HBuilder X 版本:3.4.17.20220614-alpha 已经是最新版
看了 https://ask.dcloud.net.cn/question/138290这个问题官方已经说解决了,但是实际测试还是报错
编译到H5是没有问题的,只有编译到小程序报错
3 个回复
阿立l (作者)
已经找到解决办法:
原因是项目比较旧,cli创建的项目依赖库没有升级导致,去官方的github的https://github.com/dcloudio/uni-preset-vue/tree/vite-alpha复制packge.json,再npm i安装即可
阿立l (作者)
这个问题几个月前就说解决了,难道没人发现还是报错吗?官方快点解决呀
7***@qq.com
自定义v-auth目前也报类似的错误,官方能不能解决啊