美文网首页
Vue +ts 占位符替换

Vue +ts 占位符替换

作者: 高磊_IT | 来源:发表于2021-12-20 14:31 被阅读0次

const replaceHandle = (parentStr: any, searchText: any) => {
parentStr = parentStr
.replace("{0}", splitMonth(getDate))
.replace("{1}", <span style='color:#ff3a30;'>${searchText}</span>);
return parentStr;
};

<div class="van-address-item__name">
<div v-html="replaceHandle(item.description, item.totalAmount)"></div>
</div>

相关文章

网友评论

      本文标题:Vue +ts 占位符替换

      本文链接:https://www.haomeiwen.com/subject/qekzfrtx.html