我必须做一些简单的事情。 我必须生成不同的选择选项才能生成不同的数据。
所以我创建了组件,并用值传递了数组,但仅在理论上是xD
当我上路时,我的错误感冒了:
app.js:37990 [Vue warn]: Failed to mount component: template or render
function not defined.
found in
---> <SelectComponent> at resources/js/components/SelectComponent.vue
<ExampleComponent> at resources/js/components/ExampleComponent.vue
<Root>
我的组件很容易进行测试,
<h1> test connection </h1>
<script>
export default {
name: 'SelectComponent',
data () {
return {}
}
}
</script>
我的主要组成部分
import SelectComponent from './SelectComponent.vue';
export default {
components: {
SelectComponent,
},
mounted() {
console.log('Component mounted.')
},
}
我的问题在哪里?
答案 0 :(得分:2)
如果您查看documentation,您会发现HTML应该包装在<template>
元素中。因此,将您的组件更改为:
<template>
<h1> test connection </h1>
</template>
<script>
export default {
name: 'SelectComponent',
data () {
return {}
}
}
</script>