1 Existing component written using vue example
2 If registered globally in app.js, any html page can be used normally
3 But if this component is only used on one page, how to Register this component locally on this page?
某草草2017-06-12 09:30:18
Just instantiate vue in your traditional page, introduce your component, and register it in the currently instantiated vue
var Child = {
template: '<p>A custom component!</p>'
}
new Vue({
// ...
components: {
// <my-component> 将只在父模板可用
'my-component': Child
}
})
習慣沉默2017-06-12 09:30:18
You need to read the Vue documentation 3~4 times and register locally
import YourComponent from 'your-component';
export default{
components: { YourComponent }
}