<template>
<view>1</view>
<view>2</view>
</template>
<script>
</script>
<style>
</style>
该文档编译后出现Module Error 模块错误提示
11:14:32.435 正在编译中...
11:14:33.114 INFO Starting development server...
11:14:37.884 Module Error (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js):
11:14:37.884 (Emitted value instead of an instance of Error)
11:14:37.888 Errors compiling template:
11:14:37.888 Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
11:14:37.893 1 |
11:14:37.893 2 |
11:14:37.900 3 | <view>1</view>
11:14:37.900 |
11:14:37.903 4 | <view>2</view>
11:14:37.907 | ^^^^^^^^^^^^^^
11:14:37.911 5 |
11:14:37.913 |
需要在1和2两个模块外再套一层view
<template>
<view>
<view>1</view>
<view>2</view>
</view>
</template>
<script>
</script>
<style>
</style>
也就是说在template之间只能有一个主view,
不能有两个同时出现并列的view,
如果有就只能作为子view嵌套进主view中去。
0 个评论
要回复文章请先登录或注册