42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
|
|
import { createApp } from 'vue';
|
||
|
|
import { createRouter, createWebHistory } from 'vue-router';
|
||
|
|
import ElementPlus from 'element-plus';
|
||
|
|
import 'element-plus/dist/index.css';
|
||
|
|
|
||
|
|
import App from './App.vue';
|
||
|
|
import DeviceList from './components/DeviceList.vue';
|
||
|
|
import Home from './components/Home.vue';
|
||
|
|
|
||
|
|
// 导入全局样式
|
||
|
|
import './assets/styles/main.css';
|
||
|
|
|
||
|
|
// 引入新创建的服务和工具(示例)
|
||
|
|
import ApiService from './services/apiService'; // 示例服务
|
||
|
|
import * as Utils from './utils/helpers'; // 示例工具函数
|
||
|
|
|
||
|
|
// 配置路由
|
||
|
|
const routes = [
|
||
|
|
{ path: '/', component: Home },
|
||
|
|
{ path: '/devices', component: DeviceList }
|
||
|
|
];
|
||
|
|
|
||
|
|
const router = createRouter({
|
||
|
|
history: createWebHistory(),
|
||
|
|
routes
|
||
|
|
});
|
||
|
|
|
||
|
|
// 创建Vue应用实例
|
||
|
|
const app = createApp(App);
|
||
|
|
|
||
|
|
// 使用Element Plus组件库
|
||
|
|
app.use(ElementPlus);
|
||
|
|
|
||
|
|
// 使用路由
|
||
|
|
app.use(router);
|
||
|
|
|
||
|
|
// 初始化服务(示例)
|
||
|
|
// app.config.globalProperties.$api = ApiService;
|
||
|
|
// app.config.globalProperties.$utils = Utils;
|
||
|
|
|
||
|
|
// 挂载应用
|
||
|
|
app.mount('#app');
|