1.使用v-html指令
2.传入img标签
图片地址不能使用@指代,需要填写完整路径地址。
{
id: 6,
name: "<img src='/src/assets/vue.svg'/>",
province: "河南",
time: format(new Date(), "yyyy-MM-dd"),
address: "焦作市",
},
3.筛选是否显示为图片
<template #default="scope">
<template v-if="String(scope.row[item.prop!]).includes('img')">
<div v-html="scope.row[item.prop!]"></div>
</template>
</template>