Vue js apply filter on v-model in an input field

前端 未结 7 1695
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-03 22:37

Hope someone can help me! I have made a directive wrapping the Jasny Bootstrap Plugin more specifically the input-mask thing and everything goes well!

Now I have made a

7条回答
  •  灰色年华
    2021-02-03 22:45

    This is how I implemented a vue filter for a v-model using the watch callback, this won't update the value on load.

    Vue.filter('uppercase', function (value) {
        return value.toUpperCase();
    });
    

    The html:

    
    

    And the watch callback:

    watch:{
       someData(val) {
           this.someData = this.$options.filters.uppercase(val);
        },
    }
    

提交回复
热议问题