| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { createApp } from 'vue'
- import { createPinia } from 'pinia'
- import { useLangStore } from '@/pinia/langStore'
- import ElementPlus from 'element-plus'
- import 'element-plus/dist/index.css'
- import router from './router'
- import App from './App.vue'
- import i18n from './i18n'
- // 导入自定义消息工具
- import message from './utils/message'
- // 导入全局样式(Tailwind CSS)
- import './styles/tailwind.css'
- const app = createApp(App)
- const pinia = createPinia()
- app.use(pinia)
- const langStore = useLangStore()
- langStore.initializeLang()
- // 注册 i18n
- app.use(i18n)
- // 按需注册 Element Plus 图标(仅注册实际使用的图标,减少包体积)
- // 如需全量注册,取消注释以下代码
- import * as ElementPlusIconsVue from '@element-plus/icons-vue'
- for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
- app.component(key, component)
- }
- // 全局注册 Breadcrumb 组件
- import Breadcrumb from '@/components/Breadcrumb.vue'
- app.component('Breadcrumb', Breadcrumb)
- app.use(router)
- app.use(ElementPlus)
- // 全局注册消息工具
- app.config.globalProperties.$message = message
- app.mount('#app')
- // 动态加载 PayPal SDK(从环境变量读取 client-id)
- // const paypalClientId = import.meta.env.VITE_PAYPAL_CLIENT_ID
- // if (paypalClientId) {
- // const script = document.createElement('script')
- // script.src = `https://www.paypal.com/sdk/js?client-id=${paypalClientId}¤cy=USD`
- // script.defer = true
- // document.head.appendChild(script)
- // }
- // 移除初始加载动画
- if (window.__removeLoading) {
- window.__removeLoading()
- }
|