sass語法的使用
控制檯報錯:Syntax Error: TypeError: this.getOptions is not a function
原因:版本問題,sass-loader的版本過新,安裝10.1.1版本即可解決;
路由跳轉問題
路由不跳轉:
原因:App.vue中別忘了加上<router-view></router-view>
//router: index.js
import { createRouter,createWebHashHistory} from "vue-router"'
const home = ()=> import ('../pages/home')
const colorful = ()=> import ('../pages/colorful')
const other = ()=> import('../pages/other')
const routes = [
{
path: '/',
name: 'home',
component: home
},
{
path: '/colorful',
name: 'colorful',
component: colorful
},
{
path: '/other',
name: 'other',
component: other
},
]
const router = createRouter({
history: createWebHashHistory(),
routes: routes
})
export default router
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(router)
app.mount('#app')