当前位置:网站首页>Global components component registration
Global components component registration
2022-07-29 05:30:00 【Program MS_ Wqh】
1. Again components Create one in the directory index.js file
2. stay index.js Import the components to be registered globally and Export
vue Provide install We can develop new plug-ins and global registration components
install The first parameter of the method is vue Constructor , The second parameter is the optional option object
// Import components to be registered globally
import MyForm from './MyForm'
import MyHeader from './MyHeader'
import MyAside from './MyAside'
import MyMain from './MyMain'
import Breadcrumb from './Breadcrumb'
import MyDialog from './MyDialog'
import MyTable from './MyTable'
import ContentLayout from '../../layouts/ContentLayout'
export default {
install(Vue) {
[MyTable,MyDialog,ContentLayout,Breadcrumb,MyForm,MyHeader,MyAside,MyMain].forEach(item=> Vue.component(item.name,item))
}
}
Vue.component(item.name,item) The first parameter is the name of the build The second is the imported component
Detailed instructions can be found on the official website :API — Vue.js
3. stay main.js Import
The official response to Vue.use() Method description : Through a global approach Vue.use() The use of plug-in
import Components from '@/components/index' // Import the newly created registration file
Vue.use(Components)
边栏推荐
猜你喜欢
Come on! See how Clickhouse, which has risen 16 places a year, can be implemented in jd.com
游戏行业弹性计算最佳实践
【剑指offer】— 详解库函数atoi以及模拟实现atoi函数
Together with digital people, digital space and XR platform, Alibaba cloud and its partners jointly build a "new vision"
C语言 一级指针
重定向和文件
Occt learning 001 - Introduction
During the appointment, the 2022 JD cloud industrial integration new product launch was launched online
365 day challenge leetcode 1000 questions - day 040 design jump table + avoid flooding + find the latest grouping with size M + color ball with reduced sales value
一维数组练习
随机推荐
Allocate memory: malloc() and free()
递归的基本原理
The road to success in R & D efficiency of 1000 person Internet companies
数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录
·来一篇编程之路的自我介绍吧·
Preemptive appointment | Alibaba cloud shadowless cloud application online conference appointment opens
C language file operation
Li Yan, CEO of parallel cloud: cloudxr, opens the channel to the metauniverse
来!看排名一年上升16位的ClickHouse,如何在京东落地实践
C语言 N皇后问题
Integer overflow and printing
C语言文件操作
C语言数组典型应用代码详细讲解—高手误入(逐步代码详解)
利用Poi-tl在word模板表格单元格内一次插入多张图片和多行单元格相同数据自动合并的功能组件
研发效能生态完整图谱&DevOps工具选型必看
【赛事预告】云上开发,高效智能——第二届阿里云ECS CloudBuild开发者大赛即将启动
365 day challenge leetcode 1000 questions - day 041 two point search completion anniversary + nth magic number + online election
【C语言系列】—三种方法模拟实现strlen库函数的方法
Day 1
MySQL的基础概念+数据库系统结构+拓展延申+基础命令学习