import { createApp } from 'vue'; import App from '/@/App.vue'; import { saasInit } from '/nerv-lib/saas'; import { apiModule } from '/@/api'; import { appConfig } from '/@/config'; const app = createApp(App); saasInit({ app, apiModule, appConfig, }); import nodeWrap from '/@/components/nodeWrap.vue'; app.component('NodeWrap', nodeWrap); //初始化组件 import addNode from '/@/components/addNode.vue'; app.component('AddNode', addNode); //初始化组件 app.directive('focus', { mounted(el) { el.focus(); }, }); app.directive('enterNumber', { mounted(el, { value = 100 }, vnode) { el = el.nodeName == 'INPUT' ? el : el.children[0]; const RegStr = value == 0 ? `^[\\+\\-]?\\d+\\d{0,0}` : `^[\\+\\-]?\\d+\\.?\\d{0,${value}}`; el.addEventListener('input', function () { el.value = el.value.match(new RegExp(RegStr, 'g')); el.dispatchEvent(new Event('input')); }); }, }); app.mount('#app');