<div v-for=" item in menuSide" :id="item.id">
<span >{{ item.icon} }{{item.title}}</span> // 目的 是要这个 icon图标从 menuSide 对象中读取
icon元素:{{ item.icon} } 这样写肯定是不行的。外面包个dom 这样也不行 <span v-html="item.icon"></span>
以前静态的写法:<span ><history-outlined />{{item.title}}</span>
请教正确的写法
</div>
const menuSide =[
{id:'1',title:'a',icon:'<history-outlined />', // <history-outlined /> 是 ang design ui的图标
},
{id:'2',title:'a',icon:'<tool-outlined />', // <tool-outlined /> 是 ang design ui的图标
},
]

vue3 v-html 插入dom 正确的写法请教?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-