38 lines
844 B
JavaScript
38 lines
844 B
JavaScript
import App from './App'
|
|
import Vue from 'vue'
|
|
import i18n from './locale/index.js'
|
|
|
|
Vue.config.productionTip = false
|
|
App.mpType = 'app'
|
|
|
|
Vue.directive('enterNumber', {
|
|
inserted: function (el) {
|
|
el.addEventListener("keypress",function(e){
|
|
e = e || window.event;
|
|
let charcode = typeof e.charCode == 'number' ? e.charCode : e.keyCode;
|
|
// if (parseInt(e.target.value) == 0) {
|
|
// e.preventDefault();
|
|
// }
|
|
parseInt(e.target.value) == 0 && e.preventDefault();
|
|
let re = /\d/;
|
|
if(!re.test(String.fromCharCode(charcode)) && charcode > 9 && !e.ctrlKey){
|
|
if(e.preventDefault){
|
|
e.preventDefault();
|
|
}else{
|
|
e.returnValue = false;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
import store from '@/vuex/store.js'
|
|
|
|
const app = new Vue({
|
|
i18n,
|
|
...App,
|
|
store
|
|
})
|
|
|
|
|
|
app.$mount() |