关于Vue脚手架写法的问题
2024-09-28 05:40:56
问题描述:
main.js
import Vue from 'vue'
import App from './App' /* eslint-disable no-new */
new Vue({
el: '#app',
components: { App },
template: '<App/>'
})
为什么已经定义了 components: { App } ,还需要 template: '<App/>' ?
问题解答:
el: '#app' :是指向 index.html 的<div id="app"></div>元素,该元素作为vue的挂载点
components :是声明有哪些组件
template : 是使用哪个组件
将 <App/> 挂载到 #app 这个元素,<App/> 本身是一个组件,即这里通过 components: { App } 注册组件,然后通过 template: '<App/>' 使用组件。
最新文章
- Chrome出了个小bug:论如何在Chrome下劫持原生只读对象
- 初识HTML
- jekins构建自动化项目的步骤
- Linux 多线程信号量同步
- 利用K-means聚类分类,进行特征学习
- Android 和iOS 创建本地通知
- APT 常用功能
- html5 meta头部设置
- 从ASM迁移到ARM(1):平台支持的迁移服务
- 打包程序时的证书问题(上传APP就出现Missing iOS Distribution signing indetity for)
- python 中如何导入一个自己创建的模块
- MySQL 如何存储长度较大的varchar与blob
- linux(四)之元字符
- 自定义alert窗口样式
- JavaSE:数据类型之间的转换(附常见面试题)
- Mysql 字符串分隔函数
- org.apache.commons.vfs 配置文件里面 密码包含 @
- redhat7通过yum安装nginx最新版
- 文末有福利 | IT从业者应关注哪些技术热点?
- debian 安装使用NTP
热门文章
- samb共享
- SpringMVC学习记录三——8	springmvc和mybatis整合
- 数字图像处理学习笔记之一 DIP绪论与MATLAB基础
- 【luogu P2065 [TJOI2011]卡片】 假题解
- 数据库——MySQL——多表查询
- Spring知识点总结(一)
- 微信小程序学习笔记(一)
- Angularjs基础(七)
- Invalid default value for prop ";value";: Props with type Object/Array must use a factory function to return the default value.(props default 数组/对象的默认值应当由一个工厂函数返回)
- ABAP术语-BAPI (Business Application Programming Interface)