私は現在、私のVueコンポーネントを書いています。例えば。私はVueコンポーネントを正しく書いていますか?
<template>
<NavBar></NavBar>
<div class="Footer">
<div class="left">
<p>I'm a cool footer on the Left!</p>
</div>
<div class="middle">
</div>
<div class="right">
<p>I'm a cool footer on the Right!</p>
</div>
</div>
</template>
<script>
import NavBar from './NavBar.vue';
export default {
name: 'Footer',
components: {
NavBar
}
data() {
return {
}
},
methods: {
}
}
私の質問は、私の代わりにこのようなコンポーネントを書くべきですか?もしそうなら、違いは何ですか?
Vue.component('my-component', {
template: '<div>A custom component!</div>'
})
new Vue({
el: '#example'
})
私はあなたの開発を容易にし、アプリケーションの構造を理解しやすいようにしています。 – mrogers