配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
- 发布:2024-11-06 10:25
- 更新:2024-11-06 18:06
- 阅读:357
【报Bug】[plugin:vite:vue] At least one <template> or <script> is required in a single file component
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win11
HBuilderX类型: 正式
HBuilderX版本号: 4.32
手机系统: Android
手机系统版本号: Android 15
手机厂商: 华为
手机机型: ipad
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
预期结果:
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
实际结果:
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
bug描述:
配置了下面这个排除标签就报错 这个错 [vite] [plugin:vite:vue] At least one <template> or <script> is required in a single file component.
uni(),
vue({
template: {
compilerOptions: {
isCustomElement: v => ['wx-open-launch-weapp', 'wx-open-launch-app'].includes(v)
}
}
}),
1 个回复
DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信
这里不用 vue,在 uni 里配置,带 uni({vueOptions:{xxx}}),具体看一下你项目中的 @dcloudio/vite-plugin-uni 的 d.ts