vuejs组件系统
来源:互联网 发布:手机套淘宝 编辑:程序博客网 时间:2024/06/05 07:54
组件(Component)是 Vue.js 最强大的功能之一。组件可以扩展 HTML 元素,封装可重用的代码。在较高层面上,组件是自定义元素,Vue.js 的编译器为它添加特殊功能。在有些情况下,组件也可以是原生 HTML 元素的形式,以 is 特性扩展。
1.创建和注册组件:
<template> <div> <label>Username</label> <input placeholder="username"><br/> <label>Username password</label> <input placeholder="password" key="username-possword"> <slot name="slot_h2"><h2>这里是备用内容,只有当没有插入内容的时候才显示</h2></slot> </div></template><script> export default { data () { return { } }, created () { }, methods: { },}</script>要把这个构造器用作组件,需要用 Vue.component(tag, constructor) 注册(这个注册是全局的):
//全局注册组件,tag 为 my-componentVue.component('my-component', MyComponent)
//如果用懒加载的话
Vue.component(
'my-components',
() => System.import('./../../components/modules/MyComponents')
)
<div id="example"> <my-component></my-component></div>
0 0
- vuejs组件系统
- vueJS组件
- VueJs的组件化
- vuejs 组件+路由
- vuejs学习“递归组件”
- vuejs父子组件通信
- vuejs 常用ui组件
- vuejs组件使用问题
- VueJS兄弟组件通信
- vuejs 组件的认识
- VueJS-组件通信
- vueJs图表组件
- VueJs制作轮播组件
- vuejs组件状态管理Vuex
- vuejs 幻灯片组件发开
- Vuejs 组件化开发tab组件实例
- vueJS组件笔记(针对.vue组件)
- Vuejs——(8)Vuejs组件的定义
- HTTPS和HTTP的区别
- 数据结构Java实现06----中缀表达式转换为后缀表达式
- 跑通ORB SLAM2
- 阿里云云服务器 ECS :格式化和挂载数据盘
- 强烈推荐android studio用的几个插件
- vuejs组件系统
- Linux入门(9)——Ubuntu16.04安装flash player
- VS 高级版本新建的项目如何降级使低版本 VS 可以打开
- 【CS】客户端更新(一)——更新程序文件方式
- gitignore 文件配置详解
- Linux入门(10)——Ubuntu16.04使用pip3和pip安装numpy,scipy,matplotlib等第三方库
- 数据结构Java实现07----队列:顺序队列&顺序循环队列、链式队列、顺序优先队列
- Failed to sync Gradle project '项目名称(module)' Error:failed to find Build Tools revision 20.0.0
- android锁屏界面电量百分比显示与主桌面同步