报错:An element cannot have multiple '<template>' elements which are distributed to the same slot
代码如下:
<template>
<div id="app">
<tar-bar>
<tar-bar-item class='tar-bar-item'>
<template v-slot:img>
<img src='./assets/img/tarbar/all.png'>
</template>
<template v-slot:div>
<div>新建</div>
</template>
<template v-slot:img>
<img src='./assets/img/tarbar/all.png'>
</template>
<template v-slot:div>
<div>新建</div>
</template>
</tar-bar-item>
</tar-bar>
</div>
<router-view/>
</template>
<script>
import TarBar from '@/components/tarbar/TarBar.vue'
import TarBarItem from '@/components/tarbar/TarBarItem.vue'
export default {
name:'App',
components:{
TarBar,
TarBarItem
}
}
</script>
<style>
.tar-bar-item{
flex:1;
text-align:center;
height:49px;
font-size:14px;
}
img{
height:24px;
width:24px;
margin-top:3px;
vertical-align:middle;
margin-bottom:2px;
}
</style>
加粗处报错