我看到this topic,但这是Jquery,如何将其更改为Vue.js?Vue.jsv-on
支持吗?我的错误在哪里?
<div id="vue">
<input v-model="amountModel" v-on:keyup="AddCammas()" value="{{price}}">
</div>
<script>
el: #vue,
methods:{
AddCammas : funtion(){
if(event.which >= 37 && event.which <= 40) return;
$(this).val(function(index, value) {
this.message = this.amountModel
.replace(/\D/g, "")
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
});
}
}
</script>