index.js
572 Bytes
import { createRouter, createWebHashHistory } from 'vue-router' // 改用 Hash 模式
const routes = [
{
path: '/',
redirect: '/smart-light'
},
{
path: '/smart-light',
name: 'SmartLight',
component: () => import('../views/SmartLight.vue'),
meta: { title: '动态监控' }
},
{
path: '/energy',
name: 'Energy',
component: () => import('../views/Energy.vue'),
meta: { title: '能耗' }
}
]
const router = createRouter({
history: createWebHashHistory('/iot/'), // 使用 Hash 模式
routes
})
export default router