Javascript 如何启动vue';安装后的自定义指令

Javascript 如何启动vue';安装后的自定义指令,javascript,vue.js,directive,autonumeric.js,Javascript,Vue.js,Directive,Autonumeric.js,我是vue.js的新手 我想在我的项目中使用autonumeric,然后我尝试使用vue自定义指令,但现在我面临一个问题,autonumeric总是加载初始状态/数据,而不是更新的数据。。请帮助我,这是我的剧本: var Inputmask = require('inputmask'); import AutoNumeric from "autonumeric/src/main"; new Vue({ directives: { 'input-mask' :

我是vue.js的新手

我想在我的项目中使用autonumeric,然后我尝试使用vue自定义指令,但现在我面临一个问题,autonumeric总是加载初始状态/数据,而不是更新的数据。。请帮助我,这是我的剧本:

var Inputmask = require('inputmask');
import AutoNumeric from "autonumeric/src/main";

new Vue({
  directives: {
    'input-mask'  : {
      bind: function (el) {
        new Inputmask().mask(el);
      },
    },
    'auto-numeric': {
      inserted: function (el) {
        new AutoNumeric(el, {
          digitGroupSeparator: '.',
          decimalCharacter   : ',',
          decimalPlaces      : 0,
        });
      },
    }
  },
  el        : '#auction-edit',
  methods   : {
    async submit() {
      this.loading = true;
      try {
        let {data}           = await axios.patch(this.dataAuctionUpdate + '/' + this.skey, {
          name           : this.name,
          description    : this.description,
          start_time     : this.start_time,
          finish_time    : this.finish_time,
          open_bid_price : this.open_bid_price.replace(/\./g, ''),
          next_bid_price : this.next_bid_price.replace(/\./g, ''),
          close_bid_price: this.close_bid_price.replace(/\./g, ''),
        });
        this.success         = {...data};
        window.location.href = this.adminAuction;
      } catch (e) {
        this.error = {...e.response.data};
      }
      this.loading = false;
    },
    async getData() {
      try {
        let {data}           = await axios.get(this.dataAuctionShow + '/' + this.skey);
        this.name            = data.name;
        this.description     = data.description;
        this.start_time      = data.start_time;
        this.finish_time     = data.finish_time;
        this.open_bid_price  = data.open_bid_price.toString();
        this.next_bid_price  = data.next_bid_price.toString();
        this.close_bid_price = data.close_bid_price.toString();
      } catch (e) {
        this.error = {...e.response.data};
      }
    },

    async refresh() {
      this.name            = '';
      this.description     = '';
      this.start_time      = '';
      this.finish_time     = '';
      this.open_bid_price  = '0';
      this.next_bid_price  = '0';
      this.close_bid_price = '0';
      this.permissions     = {};
      this.error           = {};
      this.success         = {};
      this.loading         = false;
      await this.getData()
    }
  },
  data      : {
    name             : '',
    description      : '',
    start_time       : '',
    finish_time      : '',
    open_bid_price   : '0',
    next_bid_price   : '0',
    close_bid_price  : '0',
    permissions      : {},
    error            : {},
    dataAuctionUpdate: '',
    dataAuctionShow  : '',
    adminAuction     : '',
    success          : {},
    loading          : false,
    skey             : '',
  },
  async mounted() {
    this.dataAuctionUpdate = $('meta[name="data-auction-update"]').attr('content');
    this.dataAuctionShow   = $('meta[name="data-auction-show"]').attr('content');
    this.skey              = $('meta[name="skey"]').attr('content');
    this.adminAuction      = $('meta[name="admin-auction"]').attr('content');
    await this.getData();
  }
});

它不是显示格式化的值,而是在开始时显示未格式化的值,然后当鼠标悬停在该值上时,将其变为0,这是vue数据的初始值,请提供帮助,非常感谢