企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 在v-html指令时如何使用过滤器 ``` // html <div class="word" v-html="$options.filters.filters2(item.news_content)"></div> // script filters: { filters2: function (arg) { arg.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) { arg = arg.replace(new RegExp(capture, 'g'), baseImgUrl + capture); }); return arg; } } ``` ## 在v-html绑定HTML的内容时,不会继承组件中的样式 ========> 解决方式: 去掉style的作用域scoped