Vue中使用组件
来源:互联网 发布:淘宝童装模特 编辑:程序博客网 时间:2024/06/05 02:09
Vue使用组件分为三步:
1、在html中使用要自定义的组件,比如
<div id="example"> <my-component></my-component></div>
2、将该组件进行注册
Vue.component('my-component', { template: '<div>A custom component!</div>'})
3、创建根实例
new Vue({ el: '#example'})
最终的渲染结果就变成了
<div id="example"> <div>A custom component!</div></div>
局部注册方式
var Child = { template: '<div>A custom component!</div>'}new Vue({ // ... components: { // <my-component> 将只在父模板可用 'my-component': Child }})
阅读全文
0 0
- Vue中使用组件
- vue中component组件的props使用
- vue中动态组件的使用
- 在vue组件中使用axios
- vue中vue-schart(图表组件)的使用
- Vue中组件(component)
- vue中常用组件
- vue component 组件使用
- vue组件使用
- vue组件使用
- vue组件的使用
- Laravel 中使用 Vue 组件化开发(配置)
- vue中vue-core-image-upload组件
- weex 中使用vue语法使用,自定义navbar组件和navpage组件
- Vue中封装input组件
- vue中引用轮播图组件
- vue中兄弟组件通信
- VUE 路由及组件使用
- 物联网笔记-----------Django单元测试,Django bug(一)
- 关于linux配置桥接网络
- CentOS 7 安装 MySQL
- untiy中与java代码交互中的问题解决
- 《程序员面试金典》最大和子矩阵
- Vue中使用组件
- 算法题总结
- 利用橡皮擦进行PS抠图的方法教程
- git常用操作
- Spamhaus -影响最大的RBL(实时黑名单列表)服务提供商,非营利性组织
- 线索二叉树
- Leetcode 435. Non-overlapping Intervals/452. Minimum Number of Arrows to Burst Balloons
- Linux内核源代码目录结构
- (1)js概述、语法1(变量、运算符、语句)