[Vuejs]-Is it possible to have a custom function to encapsulate $t function?

1👍

You must create a plugin:

const myPlugin = {
  install(Vue, options) {
    Vue.prototype.$ba_t = function(param) {
      return this.$t(param);
    };
  },
};
Vue.use(myPlugin);

This plugin create a new method that call the old method.

Leave a comment