Vue在工作中的一些用法总结
computed带参数的用法和写法
computed: {
// 写法 return一个函数
getBusinessTypeTxt({ businessType }){
return (type) => {
const text = businessType.find((item) => item.value === type);
return text ? text.label : type;
};
}
}
//用法
<template slot-scope="{row}">
{{ getBusinessTypeTxt(row.channelType) }}
</template>
在v-html中使用filter
// 平时一般都是在插值表达式中用|隔开来使用filter过滤器,在工作中遇到过需求在v-html中使用filter
v-html="$options.filters.filterName()"

浙公网安备 33010602011771号