之前vue2.0的slot没法用了,只能使用新的标签
报错信息为:`slot` attributes are deprecated vue/no-deprecated-slot-attribute
经查阅资料得知,官方文档里的slot、slot-scope已经弃用
原来使用的方法
<div class="content">
<slot name="contrite"></slot></div>
<h1 slot="contrite" class="title">内容</h1>
现在的使用方法
<div class="content">
<slot name="contrite"></slot>
</div>
<template v-slot:contrite>
内容
</template>
可简写为:
<template #contrite>
内容
</template>
在项目中的实战(想要在表格中显示图片)
<!-- 在表格中显示图片 -->
<template #textImg="{ record }">
<img style="width:30px;heigth:30px" :src="record.imageUrl" />
</template>
{
title: '代币图片',
// dataIndex: 'imageUrl'
slots : { customRender : 'textImg' }
}