export default {
mixins,
data,
props,
store,
computed,
route,
created,
ready, // => 生命周期顺序不赘述
event,
watch,
components,
methods
}
组件以驼峰命名
<template>
<my-components></my-components>
</template>
<script>
import myComponents from './myComponents.vue'
export default {
components: {
myComponents
}
}
</script>
建议:template script style 的顺序书写
<template></template>
<script></script>
<style></style>
import myComponentsA from './myComponentsA.vue'
import myComponentsB from './myComponentsB.vue'
import myComponentsC from './myComponentsC.vue'
import myComponentsD from './myComponentsD.vue'
export default {
components: {
myComponentsA,
myComponentsB,
myComponentsC,
myComponentsD,
}
}
<!-- bad -->
<a v-on:click="pass()">pass</a>
<!-- good -->
<a @click="pass">pass</a>