为了账号安全,请及时绑定邮箱和手机立即绑定

Vue.component的问题,帮忙解答一下~

Vue.component的问题,帮忙解答一下~

饮歌长啸 2018-11-08 18:38:45
Vue.component(name,obj);我看vue官网上市这样写的Vue.component('my-component', {template: '<div>A custom component!</div>'})注册一个全局的模板,<my-component><my-component>能不能不直接在template写代码,而是引用写好的.vue文件。做my-component的template??? 能的话 要怎么写???
查看完整描述

1 回答

?
慕莱坞森

TA贡献1810条经验 获得超4个赞

1.官网上的代码使用于前端非工程化开发中,比较简单的模式

2.进阶的话,也就是使用vue文件,进行编译咯哟。更多参考vue-cli 生成的 template

import Hello from "./hello.vue";

hello.vue

<template>

<div></div>

</template>

<script></script>


查看完整回答
反对 回复 2018-12-16
  • 1 回答
  • 0 关注
  • 522 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号