![]() |
霸气的大葱 · Arduino- 编译引用 ...· 1 年前 · |
![]() |
千杯不醉的骆驼 · ubuntu下eclipse无法编译 ...· 1 年前 · |
![]() |
很拉风的啄木鸟 · 将Excel文件转换为JSON格式时保留原始 ...· 1 年前 · |
![]() |
无邪的打火机 · Mac 上的 4 ...· 1 年前 · |
我正面临着我的第一个Vue项目的问题。我已经用谷歌搜索了一段时间,但找不到非常有用的东西。
我只是尝试创建一个父组件(" Files ")和子组件(" Filelist "),并在Files中使用Filelist。这并不像预期的那样工作。我看不出错误,因为我已经添加了
export default {
name: 'Filelist',
我能得到的唯一提示是从浏览器控制台
[Vue warn]: Unknown custom element: <Filelist> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <Files> at src/docs/categories/Files.vue
<App> at src/App.vue
<Root>
和
./src/App.vue (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue) 42:14-22"
export 'Filelist' was not found in '@/components/Filelist'
提前谢谢你
Files的代码:
<template>
<div class="">
<h1>Hedajo</h1>
<Filelist :msg="sometext"/>
{{ sometext }}
</template>
<script>
import { Filelist } from "@/components/Filelist.vue";
export default {
name: "Files",
components: {
Filelist
data() {
return {
sometext: "hejo",
methods: {
</script>
<style scoped>
</style>
Filelist的代码:
<template>
<component class="">
{{ msg }}
<p>hewhwe</p>
{{ hedadi }}
{{ testi }}
</component>
</template>
<script>
export default {
name: 'Filelist',
props: ["msg"],
data () {
return {
testi: "hedadi",
</script>
<style scoped>
</style>
发布于 2019-01-03 18:47:23
这是一个默认的导出,所以你不需要提取它。试一试
import Filelist from "@/components/Filelist.vue";
发布于 2019-01-03 18:48:18
在使用
FileList
之前,您需要将其注册为组件。
<template>
<div class="">
<h1>Hedajo</h1>
<Filelist :msg="sometext"/>
{{ sometext }}