init
This commit is contained in:
1
src/plugins/animate.css/index.ts
Normal file
1
src/plugins/animate.css/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
import 'animate.css'
|
||||
51
src/plugins/avue/index.ts
Normal file
51
src/plugins/avue/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { App } from 'vue'
|
||||
import Avue from '@smallwei/avue';
|
||||
import { service } from '@/config/axios/service'
|
||||
import { useLocaleStoreWithOut } from '@/store/modules/locale'
|
||||
import { isMobile } from '@/utils/domUtils';
|
||||
|
||||
import '@smallwei/avue/lib/index.css';
|
||||
import '@/styles/avueTable.scss'
|
||||
import '@/styles/avueForm.scss'
|
||||
|
||||
|
||||
export const setupAvue = async (app: App<Element>) => {
|
||||
const { getLocaleMessage } = useI18n() // 国际化
|
||||
const localeStore = useLocaleStoreWithOut()
|
||||
const currMessages = getLocaleMessage(localeStore.currentLocale.lang)
|
||||
const AvueObj = {
|
||||
axios: service,
|
||||
crudOption: {
|
||||
align: 'center',
|
||||
headerAlign: 'center',
|
||||
index: true,
|
||||
border: true,
|
||||
gridBtn: false,
|
||||
height: 'auto',
|
||||
calcHeight: 130,
|
||||
searchSpan: 6,
|
||||
searchMenuSpan: 6,
|
||||
searchMenuPosition: 'left',
|
||||
searchIndex: 3,
|
||||
searchIcon: true,
|
||||
searchShowBtn: true,
|
||||
labelSuffix: ' ',
|
||||
dialogEscape: false,
|
||||
dialogWidth: '80%',
|
||||
dialogDrag: true,
|
||||
},
|
||||
formOption: {
|
||||
labelSuffix: ' ',
|
||||
labelWidth: 120,
|
||||
},
|
||||
} as any
|
||||
if (isMobile()) {
|
||||
AvueObj.crudOption.searchShow = false
|
||||
AvueObj.crudOption.calcHeight = 80
|
||||
AvueObj.crudOption.dialogFullscreen = true
|
||||
}
|
||||
if (currMessages && currMessages['Avue']) {
|
||||
AvueObj.locale = currMessages['Avue']
|
||||
}
|
||||
app.use(Avue, AvueObj)
|
||||
}
|
||||
47
src/plugins/echarts/index.ts
Normal file
47
src/plugins/echarts/index.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import * as echarts from 'echarts/core'
|
||||
|
||||
import {
|
||||
BarChart,
|
||||
LineChart,
|
||||
PieChart,
|
||||
MapChart,
|
||||
PictorialBarChart,
|
||||
RadarChart,
|
||||
GaugeChart
|
||||
} from 'echarts/charts'
|
||||
|
||||
import {
|
||||
TitleComponent,
|
||||
TooltipComponent,
|
||||
GridComponent,
|
||||
PolarComponent,
|
||||
AriaComponent,
|
||||
ParallelComponent,
|
||||
LegendComponent,
|
||||
ToolboxComponent,
|
||||
VisualMapComponent
|
||||
} from 'echarts/components'
|
||||
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
|
||||
echarts.use([
|
||||
LegendComponent,
|
||||
TitleComponent,
|
||||
TooltipComponent,
|
||||
ToolboxComponent,
|
||||
GridComponent,
|
||||
PolarComponent,
|
||||
AriaComponent,
|
||||
ParallelComponent,
|
||||
VisualMapComponent,
|
||||
BarChart,
|
||||
LineChart,
|
||||
PieChart,
|
||||
MapChart,
|
||||
CanvasRenderer,
|
||||
PictorialBarChart,
|
||||
RadarChart,
|
||||
GaugeChart
|
||||
])
|
||||
|
||||
export default echarts
|
||||
9
src/plugins/lowDesagn/index.ts
Normal file
9
src/plugins/lowDesagn/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { App } from 'vue'
|
||||
import Sortable from 'sortablejs';
|
||||
import AvueUeditor from 'avue-plugin-ueditor'
|
||||
|
||||
window['Sortable'] = Sortable
|
||||
|
||||
export const setupLowDesagn = async (app: App<Element>) => {
|
||||
app.use(AvueUeditor)
|
||||
}
|
||||
48
src/plugins/md/editor/index.ts
Normal file
48
src/plugins/md/editor/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { App } from 'vue'
|
||||
|
||||
import VMdEditor from '@kangc/v-md-editor/lib/codemirror-editor';
|
||||
import '@kangc/v-md-editor/lib/style/codemirror-editor.css';
|
||||
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
|
||||
import '@kangc/v-md-editor/lib/theme/style/github.css';
|
||||
//任务列表
|
||||
import createTodoListPlugin from '@kangc/v-md-editor/lib/plugins/todo-list/index';
|
||||
import '@kangc/v-md-editor/lib/plugins/todo-list/todo-list.css';
|
||||
//提示信息
|
||||
import createTipPlugin from '@kangc/v-md-editor/lib/plugins/tip/index';
|
||||
import '@kangc/v-md-editor/lib/plugins/tip/tip.css';
|
||||
|
||||
// 代码高亮
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
// codemirror 编辑器的相关资源
|
||||
import Codemirror from 'codemirror';
|
||||
// mode
|
||||
import 'codemirror/mode/markdown/markdown';
|
||||
import 'codemirror/mode/javascript/javascript';
|
||||
import 'codemirror/mode/css/css';
|
||||
import 'codemirror/mode/htmlmixed/htmlmixed';
|
||||
import 'codemirror/mode/vue/vue';
|
||||
// edit
|
||||
import 'codemirror/addon/edit/closebrackets';
|
||||
import 'codemirror/addon/edit/closetag';
|
||||
import 'codemirror/addon/edit/matchbrackets';
|
||||
// placeholder
|
||||
import 'codemirror/addon/display/placeholder';
|
||||
// active-line
|
||||
import 'codemirror/addon/selection/active-line';
|
||||
// scrollbar
|
||||
import 'codemirror/addon/scroll/simplescrollbars';
|
||||
import 'codemirror/addon/scroll/simplescrollbars.css';
|
||||
// style
|
||||
import 'codemirror/lib/codemirror.css';
|
||||
|
||||
VMdEditor.Codemirror = Codemirror;
|
||||
VMdEditor.use(githubTheme, {
|
||||
Hljs: hljs,
|
||||
});
|
||||
VMdEditor.use(createTodoListPlugin());
|
||||
VMdEditor.use(createTipPlugin());
|
||||
|
||||
export const setupMdEditor = async (app: App<Element>) => {
|
||||
app.use(VMdEditor)
|
||||
}
|
||||
25
src/plugins/md/preview/index.ts
Normal file
25
src/plugins/md/preview/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { App } from 'vue'
|
||||
|
||||
import VMdPreview from '@kangc/v-md-editor/lib/preview';
|
||||
import '@kangc/v-md-editor/lib/style/preview.css';
|
||||
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
|
||||
import '@kangc/v-md-editor/lib/theme/style/github.css';
|
||||
|
||||
//任务列表
|
||||
import createTodoListPlugin from '@kangc/v-md-editor/lib/plugins/todo-list/index';
|
||||
import '@kangc/v-md-editor/lib/plugins/todo-list/todo-list.css';
|
||||
//提示信息
|
||||
import createTipPlugin from '@kangc/v-md-editor/lib/plugins/tip/index';
|
||||
import '@kangc/v-md-editor/lib/plugins/tip/tip.css';
|
||||
// highlightjs
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
VMdPreview.use(githubTheme, {
|
||||
Hljs: hljs,
|
||||
});
|
||||
VMdPreview.use(createTodoListPlugin());
|
||||
VMdPreview.use(createTipPlugin());
|
||||
|
||||
export const setupMdPreview = async (app: App<Element>) => {
|
||||
app.use(VMdPreview)
|
||||
}
|
||||
38
src/plugins/noNetIconify/index.ts
Normal file
38
src/plugins/noNetIconify/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
//!!!!无法访问外网环境时,动态图标无法显示解决方案!!!!
|
||||
|
||||
|
||||
// import { getIcon, addIcon } from '@iconify/iconify';
|
||||
|
||||
//1.直接导入使用的图标集(会导致包比较大)
|
||||
//用到哪些图标集就导入哪些
|
||||
|
||||
// import epJson from '@iconify/json/json/ep.json';
|
||||
|
||||
// const iconJsonObj = { epJson }
|
||||
|
||||
// const initNoNetGather = () => {
|
||||
// for (const key in iconJsonObj) {
|
||||
// Object.keys(iconJsonObj[key].icons).forEach((iconName) => {
|
||||
// const fullName = `${iconJsonObj[key].prefix}:${iconName}`; // 图标名称格式:前缀 + 名称
|
||||
// addIcon(fullName, iconJsonObj[key].icons[iconName].body);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// initNoNetGather()
|
||||
|
||||
//2.只导入使用的图标(包小,需要一个一个添加图标名称 麻烦)
|
||||
|
||||
//项目中动态使用的图标名称集
|
||||
// const iconsList = ['ep:add-location']
|
||||
|
||||
// //动态添加离线图标
|
||||
// const initNoNetIcon = () => {
|
||||
// iconsList.forEach(icon => {
|
||||
// const iconJson = getIcon(icon)
|
||||
// console.log(iconJson)
|
||||
// if (iconJson) addIcon(icon, iconJson)
|
||||
// })
|
||||
// }
|
||||
|
||||
// initNoNetIcon()
|
||||
3
src/plugins/svgIcon/index.ts
Normal file
3
src/plugins/svgIcon/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import 'virtual:svg-icons-register'
|
||||
|
||||
import '@purge-icons/generated'
|
||||
23
src/plugins/tongji/index.ts
Normal file
23
src/plugins/tongji/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import router from '@/router'
|
||||
|
||||
// 用于 router push
|
||||
window._hmt = window._hmt || []
|
||||
// HM_ID
|
||||
const HM_ID = import.meta.env.VITE_APP_BAIDU_CODE
|
||||
;(function () {
|
||||
// 有值的时候,才开启
|
||||
if (!HM_ID) {
|
||||
return
|
||||
}
|
||||
// const hm = document.createElement('script')
|
||||
// hm.src = 'https://hm.baidu.com/hm.js?' + HM_ID
|
||||
// const s = document.getElementsByTagName('script')[0]
|
||||
// s.parentNode.insertBefore(hm, s)
|
||||
})()
|
||||
|
||||
router.afterEach(function (to) {
|
||||
if (!HM_ID) {
|
||||
return
|
||||
}
|
||||
_hmt.push(['_trackPageview', to.fullPath])
|
||||
})
|
||||
1
src/plugins/unocss/index.ts
Normal file
1
src/plugins/unocss/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
import 'virtual:uno.css'
|
||||
3
src/plugins/vueI18n/helper.ts
Normal file
3
src/plugins/vueI18n/helper.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const setHtmlPageLang = (locale: LocaleType) => {
|
||||
document.querySelector('html')?.setAttribute('lang', locale)
|
||||
}
|
||||
43
src/plugins/vueI18n/index.ts
Normal file
43
src/plugins/vueI18n/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { App } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import { useLocaleStoreWithOut } from '@/store/modules/locale'
|
||||
import type { I18n, I18nOptions } from 'vue-i18n'
|
||||
import { setHtmlPageLang } from './helper'
|
||||
|
||||
export let i18n: ReturnType<typeof createI18n>
|
||||
|
||||
const createI18nOptions = async (): Promise<I18nOptions> => {
|
||||
const localeStore = useLocaleStoreWithOut()
|
||||
const locale = localeStore.getCurrentLocale
|
||||
const localeMap = localeStore.getLocaleMap
|
||||
const defaultLocal = await import(`../../locales/${locale.lang}.ts`)
|
||||
const message = defaultLocal.default ?? {}
|
||||
|
||||
setHtmlPageLang(locale.lang)
|
||||
|
||||
localeStore.setCurrentLocale({
|
||||
lang: locale.lang
|
||||
// elLocale: elLocal
|
||||
})
|
||||
|
||||
return {
|
||||
legacy: false,
|
||||
locale: locale.lang,
|
||||
fallbackLocale: 'zh-CN', //没有符合的就显示中文
|
||||
messages: {
|
||||
[locale.lang]: message
|
||||
},
|
||||
availableLocales: localeMap.map((v) => v.lang),
|
||||
sync: true,
|
||||
silentTranslationWarn: true,
|
||||
missingWarn: false,
|
||||
fallbackWarn: false,
|
||||
silentFallbackWarn: true,
|
||||
}
|
||||
}
|
||||
|
||||
export const setupI18n = async (app: App<Element>) => {
|
||||
const options = await createI18nOptions()
|
||||
i18n = createI18n(options) as I18n
|
||||
app.use(i18n)
|
||||
}
|
||||
Reference in New Issue
Block a user