-
Do not use 'new' for side effects.eslint(no-new)
解决方法,加上/* eslint-disable no-new */
///* eslint-disable no-new */
new Vue({
el: '#layout',
components: { Layout },
template: '<App/>'
})
- 如何组件复用
复用layout
src
| ---- Layout.vue
| ---- Service.vue
Layout.vue
<template>
<div class="layout"
id="layout">
<h1>你好,这是组件背景<h1>
</div>
</template>
Service.vue
<template>
<div class="service">
<layout></layout>
</div>
</template>
<script>
import Layout from './Layout.vue'
export default {
name: 'service',
components: {
'layout': Layout
}
</script>