mui-v-html中使用过滤器filters功能
<script>mui.init({swipeBack:true //启用右滑关闭功能});var dailylist = new Vue({el: '#contentlis...
<script>
mui.init({
swipeBack:true //启用右滑关闭功能
});
var dailylist = new Vue({
el: '#contentlist',
data: {
items: [] //列表信息流数据
},
methods:{
add:function(list){
this.items = this.items.concat(list);
}
},
filters: {
unescape:function (cval,minval,maxval) {
var imgStr="";
if(cval<minval){
imgStr="<img src='../images/tjbg_down.png' style='height: 14px;vertical-align: middle; margin-top: -2px; margin-left: -25px;' /><br />";
}
if(cval>maxval){
imgStr="<img src='../images/tjbg_up.png' style='height: 14px;vertical-align: middle; margin-top: -2px; margin-left: -25px;' /><br />";
}
return imgStr
.replace(imgStr ? /&(?!#?\w+;)/g : /&/g, '&')
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, "\"")
.replace(/'/g, "\'");
}
}
});
</script>
================================================================================================
HTML: <span v-html="$options.filters.unescape(85,90,95)">123</span>
更多推荐
所有评论(0)