I just started using Vue2 with Laravel6 and got stuck when trying to understand how to use component method.
As I am totally new for Vue, I am using the official tutorial of Vue as a reference. What I learned from here(https://vuejs.org/v2/guide/components.html) about Vue component instantiation is we give options to a component.(e.g. we give 'template:' options for HTML part.)
When I look at laravel6 codes of resouces/js/app.js, it looks something like this:
Vue.component('example-component', require('./components/ExampleComponent.vue').default); I looked at js/components/ExampleComponent.vue expecting to see some options declared there. However, there's no option in the ExampleComponent.vue file. Instead, I see <template></template> tag. Apparently, the <template></template> tag seems to work as 'template:' option.
I have two questions regarding above:
- Does
<template></template>tag have the same meaning as 'template:' option? - If question 1 is yes, are other options also replacable with corresponding tags? (e.g. Can I use
<props></props>tag for 'props:' option? or<data></data>tag for 'data:' option?
Thanks in advance!
https://stackoverflow.com/questions/65526590/vue2-laravel6-component-implementation January 01, 2021 at 08:49AM
没有评论:
发表评论