1
This commit is contained in:
77
demo/index.html
Normal file
77
demo/index.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Framework Demo</title>
|
||||
|
||||
<!-- 引入 iView 样式 -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/view-design@4.7.0/dist/styles/iview.css">
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
|
||||
}
|
||||
#app {
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
<!-- 引入依赖库 -->
|
||||
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
|
||||
<script src="https://unpkg.com/vue-router@3.5.3/dist/vue-router.js"></script>
|
||||
<script src="https://unpkg.com/vuex@3.6.2/dist/vuex.js"></script>
|
||||
<script src="https://unpkg.com/view-design@4.7.0/dist/iview.js"></script>
|
||||
<script src="https://unpkg.com/axios@0.27.2/dist/axios.js"></script>
|
||||
|
||||
<!-- 引入 admin-framework -->
|
||||
<script src="../dist/admin-framework.js"></script>
|
||||
|
||||
<script>
|
||||
// 获取框架实例
|
||||
const framework = window.AdminFramework
|
||||
|
||||
// 配置参数
|
||||
const config = {
|
||||
title: 'Admin Framework Demo',
|
||||
apiUrl: 'http://localhost:3000/api/', // 修改为你的 API 地址
|
||||
uploadUrl: 'http://localhost:3000/api/upload' // 修改为你的上传地址
|
||||
}
|
||||
|
||||
// 初始化框架
|
||||
framework.install(Vue, {
|
||||
config: config,
|
||||
ViewUI: iview,
|
||||
VueRouter: VueRouter,
|
||||
Vuex: Vuex,
|
||||
createPersistedState: null, // 如需持久化,需引入 vuex-persistedstate
|
||||
componentMap: {} // 可添加自定义组件映射
|
||||
})
|
||||
|
||||
// 创建 Vue 实例
|
||||
const app = new Vue({
|
||||
router: framework.router,
|
||||
store: framework.store,
|
||||
render: h => h('router-view')
|
||||
})
|
||||
|
||||
// 挂载应用
|
||||
app.$mount('#app')
|
||||
|
||||
// 将 app 实例挂载到 window,方便调试
|
||||
window.app = app
|
||||
window.rootVue = app
|
||||
|
||||
console.log('Admin Framework Demo 启动成功!')
|
||||
console.log('框架实例:', framework)
|
||||
console.log('路由实例:', framework.router)
|
||||
console.log('Store 实例:', framework.store)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user