html 动态添加的class无效
<span class="city-name" v-html="item[3]"> </span> //html部分
this.cityLists[i][3] = `<span>${splitVal[0]}</span><span>${this.cityKeyWord}</span><span>${splitVal[1]}</span>`
//js部分 动态添加class为"checked-city"
<style scoped> .searchDiv >>> .checked-city { color: #009EFF; } </style> //注意style加了lang之后无效
效果展示
vue 使用v-html 动态添加的class无效
,温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/41778.html
- 上一篇:DIV完美等分的CSS样式实现
- 下一篇:css实现斑马线效果