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>
添加回答
举报
0/150
提交
取消