1
This commit is contained in:
59
demo/src/main.js
Normal file
59
demo/src/main.js
Normal file
@@ -0,0 +1,59 @@
|
||||
// 引入依赖
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import Vuex from 'vuex'
|
||||
import ViewUI from 'view-design'
|
||||
import axios from 'axios'
|
||||
|
||||
// 引入样式
|
||||
import 'view-design/dist/styles/iview.css'
|
||||
|
||||
// 引入 Admin Framework(使用本地构建的文件)
|
||||
import AdminFramework from '../../dist/admin-framework.js'
|
||||
|
||||
// 引入组件映射表
|
||||
import componentMap from './router/component-map.js'
|
||||
|
||||
// 使用插件
|
||||
Vue.use(ViewUI)
|
||||
|
||||
// 配置参数
|
||||
const config = {
|
||||
title: 'Admin Framework Demo',
|
||||
apiUrl: 'http://localhost:9098/admin_api/', // 修改为你的 API 地址
|
||||
uploadUrl: 'http://localhost:9098/admin_api/upload' // 修改为你的上传地址
|
||||
}
|
||||
|
||||
// 初始化框架
|
||||
AdminFramework.install(Vue, {
|
||||
config: config,
|
||||
ViewUI: ViewUI,
|
||||
VueRouter: VueRouter,
|
||||
Vuex: Vuex,
|
||||
createPersistedState: null,
|
||||
componentMap: componentMap // 传入组件映射表,用于动态路由
|
||||
})
|
||||
|
||||
// 创建 Vue 实例
|
||||
const app = new Vue({
|
||||
router: AdminFramework.router,
|
||||
store: AdminFramework.store,
|
||||
render: h => h('router-view'),
|
||||
created() {
|
||||
console.log('=== Admin Framework Demo 启动成功 ===')
|
||||
console.log('框架版本:', AdminFramework.version)
|
||||
console.log('配置信息:', this.$config)
|
||||
}
|
||||
})
|
||||
|
||||
// 挂载应用
|
||||
app.$mount('#app')
|
||||
|
||||
// 全局暴露(方便调试)
|
||||
window.app = app
|
||||
window.rootVue = app
|
||||
window.framework = AdminFramework
|
||||
|
||||
// 提示信息
|
||||
ViewUI.Message.success('Admin Framework Demo 启动成功!')
|
||||
|
||||
Reference in New Issue
Block a user