溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

vue學(xué)習(xí)

發(fā)布時間:2020-07-16 02:51:38 來源:網(wǎng)絡(luò) 閱讀:279 作者:張孝國 欄目:web開發(fā)

Vue CLI 3.0介紹:

https://cli.vuejs.org/zh/guide/?

Vue CLI 3.0配置參考

https://cli.vuejs.org/zh/config/?

https://youzan.github.io/vant/#/zh-CN?

hub.com/shimiso/VueFrameWork

https://shimiso.github.io/VueFrameWork/dist/#/

https://github.com/shimiso/VueDemo

這是我們組內(nèi)搞的vue的學(xué)習(xí)視頻,40節(jié)課demo,一周上手,2周出活

https://edu.csdn.net/course/detail/5342


vue路由配置

  1. index.js 中引入文件??import Reg from '@/components/Reg'

  2. 配置路由

????export default new Router({

????????????routes: [

????????????????????{

????????????????????path: '/',

????????????????????component: HelloWorld,

????????????????????},

????????????????????{

????????????????????path: '/login',

????????????????????component: Login,

????????????????????},

????????????????????{

????????????????????path: '/reg',

????????????????????component: Reg,

????????????????????},

????????????]

????})

3.創(chuàng)建文件

????<template>

????<div>

????<ComHeader></ComHeader>

????注冊內(nèi)容

????<ComFooter></ComFooter>

????</div>

????</template>

????<script>

????</script>

????<style scoped>

????</style>


Vue 公用文件配置

  1. 創(chuàng)建公用文件 Footer.vue

????????<template>

????????<div>

????????<p>我是尾部組件</p>

????????</div>

????????</template>

????????<script>

????????export default {

????????}

????????</script>

????????<style ?scoped></style>

??2. 引入文件

????import?ComHeader?from?'./components/common/Header'

????import?ComFooter?from?'./components/common/Footer'

? 3.注冊標簽

????export default {

????????name: 'App',

????????components:{

????????????ComHeader,

????????????ComFooter,

????????}

????}

? 4.引入標簽?

????<ComFooter></ComFooter>


守衛(wèi)

全局守衛(wèi)(main.js)

router.beforeEach((to, from, next) => {

????//會在任意路由跳轉(zhuǎn)前執(zhí)行,next一定要記著執(zhí)行,不然路由不能跳轉(zhuǎn)了

????alert(111);

????next();

})

獨享路由守衛(wèi)

export default new Router({

routes:

????[

????????????{

????????????path: '/',

????????????component: HelloWorld,

????????????},

????????????{

????????????path: '/login',

????????????component: Login,

????????????beforeEnter: (to, from, next) => {

????????????// ..

????????????console.log('經(jīng)過路由守衛(wèi)');

????????????}

????????????},

????????????{

????????????path: '/reg',

????????????component: Reg,

????????????},

????????????{

????????????path: '/user',

????????????component: User,

????????????},

??????]

})





向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI