當(dāng)前版本: 3.0.3
類目錄: src/history/base.js
前言:
對于vue-router來說,有三種路由模式history,hash,abstract, abstract是運行在沒有window的環(huán)境下的,這三種模式都是繼承于history類,history實現(xiàn)了一些共用的方法,對于一開始看vue-router源碼來說,可以從這里開始看起。
初始屬性
router: Router; 表示VueRouter實例。實例化History類時的第一個參數(shù) base: string; 表示基路徑。會用normalizeBase進行規(guī)范化。實例化History類時的第二個參數(shù)。 current: Route; 表示當(dāng)前路由(route)。 pending: ?Route; 描述阻塞狀態(tài)。 cb: (r: Route) => void; 監(jiān)聽時的回調(diào)函數(shù)。 ready: boolean; 描述就緒狀態(tài)。 readyCbs: Array<Function>; 就緒狀態(tài)的回調(diào)數(shù)組。 readyErrorCbs: Array<Function>; 就緒時產(chǎn)生錯誤的回調(diào)數(shù)組。 errorCbs: Array<Function>; 錯誤的回調(diào)數(shù)組 // implemented by sub-classes <!-- 下面幾個是需要子類實現(xiàn)的方法,這里就先不說了,之后寫其他類實現(xiàn)的時候分析 --> +go: (n: number) => void; +push: (loc: RawLocation) => void; +replace: (loc: RawLocation) => void; +ensureURL: (push?: boolean) => void; +getCurrentLocation: () => string;
網(wǎng)頁標(biāo)題:vue-router源碼之history類的淺析-創(chuàng)新互聯(lián)
標(biāo)題路徑:http://chinadenli.net/article16/deigdg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、建站公司、面包屑導(dǎo)航、網(wǎng)站營銷、云服務(wù)器、網(wǎng)站設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容