vue2.x搭建saas專案系列之六:component統一註冊
阿新 • • 發佈:2021-02-13
此篇幅主要介紹、我們是如何做元件的,如有不足和建議請留言,在此感謝,專案目前階段還處在少年,一直在迭代,路由版本目前為v1.0.0
元件目錄結構如圖
├──components # 元件相關所有檔案
││──basicCp # 基礎元件可延伸
││──businessCp # 業務型元件比較固定
││──Element #Element
│└──index.ts # 核心配置檔案
這裡主要介紹下index.ts,元件業務場景不同,有些支援同步載入,有些支援非同步載入
// basicCp 同步載入
// button
import ffuiButton from './basicCp/Button/index.vue'
Vue.component('ffui-button', ffuiButton )
非同步載入
// 返回頂部
Vue.component('ffui-back-to-top', () => import('./basicCp/BackToTop/index.vue'))
main.ts
// 全域性 引入 自定義元件
import '@/components'
到此,component統一註冊-文章結束,原創不易,感謝瀏覽!