Files
hht-ynhl-one-uni/main.js
2026-01-19 11:12:33 +08:00

50 lines
1.1 KiB
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;
}
}
});
}
});
Vue.filter('findByValue', (array, value) => {
if (!Array.isArray(array)) return ''
const item = array.find(item => item.value === value)
return item ? item.text : ''
});
Vue.prototype.$langPre = {
computedProp (suffix) {
return i18n.locale.slice(0, 2) + '_' + suffix
}
}
import store from '@/vuex/store.js'
const app = new Vue({
i18n,
...App,
store
})
app.$mount()