<div class="item-total"> Item total: <span class="total-price" v-text="totalPrice | unitFilter2('元')"></span></div>这样写报“unitFilter2 is not defined”<div class="item-total"> Item total: <span class="total-price">{{totalPrice | unitFilter2('元')}}</span></div>这样写正确但我在网上查询说{{}}是v-text的简写,这是什么原因呢?
1 回答
kevinZee
TA贡献50条经验 获得超39个赞
错误和v-text无关,是vue2.0不让在插值表达式和v-bind外的地方使用管道。
Filters can now only be used inside text interpolations ({{}} tags). In the past we've found using filters with directives such as v-model, v-on etc. led to more complexity than convenience, and for list filtering on v-for it is more appropriate to move that logic into JavaScript as computed properties.
添加回答
举报
0/150
提交
取消