嗨,我有这个html代码
<input type='text' :value='{{$poss["pos_discount_value"]}}' v-model='pos_discount_value' />这是vuejs2代码
data:{
message:'',
item_search_array:false,
arrayresults:[],
total:0,
quantity:1,
discount:0,
pos_discount_value:0,
},现在,我在pos_discount_value代码中将vuejs2定义为0,在html代码中,它来自数据库的值定义为不同的值,如何将pos_discount_value的默认值设置为值来自html,而不是0
发布于 2018-12-22 11:00:41
此外,还可以在created钩子上使用自定义事件。
<input type='text' @initDiscount='pos_discount_value={{$poss["pos_discount_value"]}}' v-model='pos_discount_value' />
created: function () {
this.$emit('initDiscount');
}发布于 2018-12-22 10:47:46
我喜欢这样
<input
v-model="pos_discount_value"
:run="!pos_discount_value ? pos_discount_value = {{$poss['pos_discount_value']}} : true"
/>谢谢你们
https://stackoverflow.com/questions/53894897
复制相似问题