javascript - 在 vue 组件上设置 props 值

标签 javascript vue.js vue-component

我已经编写了一个应该接收“uploadedFile” Prop 的 vue 组件,但它不工作。 我刚刚收到有关 $attrs 的正确信息:

enter image description here

我的组件:

Vue.component('table-file', {
props: ['files'],
template: '<div class="row"><table class= "table table-sm table-hover"><thead><tr><th scope="col" style="text-align: center">FILE NAME</th><th scope="col" style="text-align: center; width: 20%;" colspan="2">OPTIONS</th></tr></thead><tbody><tr v-for="(file, index) in files" :key="index" style="text-align: center;"><td scope="row" style="font-size: medium !important">{{file.FileName}}</td><td><Button class="btn btn-info btn-raised" v-on:click="downloadFile(file.ID)" style="margin: 0">Download</Button></td><td>\<Button class="btn btn-info btn-raised" v-on:click="deleteFile(file.ID)" style="margin: 0; background-color: red">Delete</Button></td></tr></tbody ></table ></div >'
})
<table-file :files="uploadedFile"></table-file>

谁能帮帮我?

最佳答案

您的文件名为 uploadedfile 而不是 uploadedFile

关于javascript - 在 vue 组件上设置 props 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65427905/

相关文章:

javascript - 为什么在组件库vue js中没有对组件应用Prop?

javascript - 只有在父组件的异步方法完成后才渲染子组件

javascript - 如何在单击纸质按钮时触发 iron-ajax 请求?

javascript - 面对数学函数的问题

javascript - 在 TypeScript 中导入本地安装的 Node 模块

javascript - 如何在Vue js中的v-for循环中使用v-model

javascript - 在另一个 vue 组件中使用 Vue JS 组件方法

javascript - 如何从子域获取 cookie?

javascript - Vuetify 选择默认值

javascript - 在 v-for 循环中获取值到 vuejs 中的方法