49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { createApp } from 'vue'
|
|
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import store from './stores/index'
|
|
import 'normalize.css'
|
|
import './assets/css/style.css'
|
|
import SvgIcon from "@/components/SvgIcon/index.vue";
|
|
import "virtual:svg-icons-register";
|
|
|
|
import i18n from "./lang/index";
|
|
import flexible from "./utils/flexible.js";
|
|
|
|
import "./router/router-config" // 路由守卫,做动态路由的地方
|
|
import ElementPlus from 'element-plus'
|
|
import 'element-plus/dist/index.css'
|
|
|
|
import ignoredWarning from './ignoredWarning'
|
|
|
|
import vEllipsis from './utils/ellispsis'
|
|
|
|
|
|
const app = createApp(App)
|
|
ignoredWarning(app)
|
|
app.directive('ellipsis', vEllipsis)
|
|
app.use(router)
|
|
.use(ElementPlus)
|
|
.use(store)
|
|
.component("SvgIcon", SvgIcon)
|
|
.use(i18n)
|
|
.mount('#app')
|
|
|
|
const vLoadimg = (el, binding) => {
|
|
const src = binding.value
|
|
if (el.src === src) return
|
|
const img = new Image()
|
|
img.src = src
|
|
img.onload = () => {
|
|
el.src = src
|
|
}
|
|
img.onerror = () => {
|
|
console.log('图片加载失败:', src)
|
|
}
|
|
}
|
|
// 注册
|
|
app.directive('loadimg', vLoadimg)
|
|
flexible();
|
|
|