v-for报错Cannot use v-for on stateful component root element because it renders multiple elements.

v-for报错Cannot use v-for on stateful component root element because it renders multiple elements.,第1张

当时是这样写的,在vue和uniapp中不能把v-for放在根元素上,


//   错误代码

<template>
	<view class="list" v-for="(item, index) in 5" :key="index"
		@click="$common.jump('/pages/Project-library/list/details')">
	</view>
</template>


//   正确代码

<template>
	<view class="box">
		<view class="list" v-for="(item, index) in 5" :key="index"
			@click="$common.jump('/pages/Project-library/list/details')">
		</view>
	</view>
</template>

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1297207.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-10
下一篇2022-06-10

发表评论

登录后才能评论

评论列表(0条)

    保存