Some checks failed
Check / lint (push) Has been cancelled
Check / typecheck (push) Has been cancelled
Check / build (build, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build, 18.x, windows-latest) (push) Has been cancelled
Check / build (build:app, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build:app, 18.x, windows-latest) (push) Has been cancelled
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Has been cancelled
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
import { createSSRApp } from 'vue'
|
|
import App from './App.vue'
|
|
import dayjs from "dayjs";
|
|
import 'virtual:uno.css'
|
|
import VConsole from "vconsole";
|
|
import '@/utils/uni.webview.js'
|
|
import tmui from "@/uni_modules/tmui"
|
|
import {config} from "@/config/tmui/index.js";
|
|
import 'dayjs/locale/zh-cn';
|
|
import xLoaderror from '@/components/x-loaderror/index.vue'
|
|
import { vLoading } from "@/components/x-loading/index.js"
|
|
import messagePopup from '@/components/x-message/useMessagePopup'
|
|
import pageAnimation from '@/components/page-animation/index.vue'
|
|
import * as plugins from './plugins'
|
|
const {showMessage}=messagePopup()
|
|
dayjs.locale('zh-cn')
|
|
if (import.meta.env.VITE_SHOW_CONSOLE){
|
|
new VConsole()
|
|
}
|
|
export function createApp() {
|
|
const app = createSSRApp(App)
|
|
plugins.setPinia(app)
|
|
plugins.setComponents(app)
|
|
app.use(tmui,{...config})
|
|
app.directive("loading", vLoading)
|
|
app.mixin(pageAnimation)
|
|
app.component('x-loaderror',xLoaderror)
|
|
app.directive('no-space', {
|
|
mounted(el) {
|
|
el.addEventListener('input', (e) => {
|
|
const originalValue = e.target.value;
|
|
const newValue = originalValue.replace(/\s/g, '');
|
|
if (originalValue !== newValue) {
|
|
e.target.value = newValue;
|
|
e.target.dispatchEvent(new Event('input'));
|
|
}
|
|
});
|
|
}
|
|
})
|
|
window.message = ['success', 'error', 'warning'].reduce((acc, type) => {
|
|
acc[type] = (message) => {
|
|
if (typeof message === 'string') {
|
|
showMessage({ type, message });
|
|
} else if (typeof message === 'object') {
|
|
showMessage({ type, ...message });
|
|
}
|
|
};
|
|
return acc;
|
|
}, {});
|
|
return {
|
|
app,
|
|
}
|
|
}
|
|
createApp()
|