mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2025-11-12 14:27:49 +00:00
国际化、主题处理
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { useGlobalConfigStore } from '@/stores/globalConfigStore'
|
||||
import { $changeLocale, elementLocale } from '@/languages/MessagesConfig'
|
||||
import { $changeLocale, elementLocale } from '@/messages'
|
||||
|
||||
const globalConfigStore = useGlobalConfigStore()
|
||||
$changeLocale(globalConfigStore.currentLocale)
|
||||
|
||||
9
src/components/common-input/index.vue
Normal file
9
src/components/common-input/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<template />
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
8
src/icons/index.js
Normal file
8
src/icons/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
export default {
|
||||
install (app) {
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/main.js
20
src/main.js
@@ -2,27 +2,23 @@ import { createApp } from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
import { usePinia } from '@/stores'
|
||||
import stores from '@/stores'
|
||||
import icons from '@/icons'
|
||||
import messages from '@/messages'
|
||||
import commons from '@/components'
|
||||
|
||||
import messagesConfig from '@/languages/MessagesConfig'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import App from '@/App.vue'
|
||||
import router from '@/router'
|
||||
|
||||
import './assets/main.css'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(usePinia)
|
||||
app.use(stores)
|
||||
app.use(router)
|
||||
app.use(ElementPlus)
|
||||
app.use(messagesConfig)
|
||||
app.use(icons)
|
||||
app.use(messages)
|
||||
app.use(commons)
|
||||
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
@@ -2,7 +2,13 @@ import { defineStore, createPinia } from 'pinia'
|
||||
import piniaPluginPersistedState from 'pinia-plugin-persistedstate'
|
||||
import { useGlobalConfigStore } from '@/stores/globalConfigStore'
|
||||
|
||||
export const usePinia = {
|
||||
export const useStore = defineStore('store', () => {
|
||||
return {
|
||||
globalConfig: useGlobalConfigStore()
|
||||
}
|
||||
})
|
||||
|
||||
export default {
|
||||
install (app) {
|
||||
const pinia = createPinia()
|
||||
pinia.use(piniaPluginPersistedState)
|
||||
@@ -10,8 +16,3 @@ export const usePinia = {
|
||||
return pinia
|
||||
}
|
||||
}
|
||||
export const useStore = defineStore('store', () => {
|
||||
return {
|
||||
globalConfig: useGlobalConfigStore()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user