升级vue3注意事项记录 vue3都需要升级些什么
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')
本文来自博客园,作者:叶子玉,转载请注明原文链接:https://www.cnblogs.com/knuzy/p/15143850.html