Closed sunmingtao closed 4 years ago
Create a mixin.js
export default { data(){ return { currencyReferenceData: { cny: 1, }, isDataFetched: false, } }, methods: { isNumber(evt) { evt = (evt) ? evt : window.event; var charCode = (evt.which) ? evt.which : evt.keyCode; if ((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode !== 46) { evt.preventDefault(); } else { return true; } }, } }
App.vue
import myMixin from '../mixin'; export default { mixins: [myMixin], methods: { ... } }
Create a mixin.js
App.vue