Vue.component(name,obj);
I saw it written like this on the vue official website
Vue.component('my-component', {
template: '<p>A custom component !</p>'
})
Register a global template, <my-component><my-component>
Can I not write the code directly in the template?
Instead, reference the written .vue file. Make a template for my-component? ? ? If so, how should I write it? ? ?
漂亮男人2017-05-31 10:43:32
1. The code on the official website is used in front-end non-engineering development, which is a relatively simple model
2. If you want to advance, you can use vue files to compile. For more reference, please refer to the template generated by vue-cli
import Hello from "./hello.vue";
hello.vue
<template>
<p></p>
</template>
<script></script>