我想让v-model的数据经过data的一番处理显示可以做到么?
我想显示5星级
<div>
<x-input title="" @on-focus='showPopupStar' @on-click='showPopupStar' v-model='star' name='eee'
placeholder="位置/关键字/品牌/酒店"></x-input>
</div>
data(){
return {
star:5
}
}
然后我这样尝试过都不行,如何处理?
<div>
<x-input title="" @on-focus='showPopupStar' @on-click='showPopupStar' v-model='showStar' name='eee'
placeholder="位置/关键字/品牌/酒店"></x-input>
</div>
computed:{
showStar(){
return this.star+"星级"
}
}
<div>
<x-input title="" @on-focus='showPopupStar' @on-click='showPopupStar' v-model='showStar(star)' name='eee'
placeholder="位置/关键字/品牌/酒店"></x-input>
</div>
computed:{
showStar(e){
return e+"星级"
}
}
如何在v-model里显示经过计算的值呢?
官方文档:https://vuex.vuejs.org/zh/gui...