Vue.js抛出多个警告:无效的prop:对于prop"items"类型检查失败.预期数组,得到值为""的字符串

sai*_*tam 0 rest node.js express vue.js vuetify.js

vue-cli用于前端和express后端.我的后端数据的处理时间是1.7秒,如果我做了请求mounted (),vue已经读过data ()并给我警告,它期待其他类型,不能排序等.

有没有办法在没有警告的情况下做到这一点?

这是我的html部分:

   <v-data-table
        class="ownstyle"
        :headers="headers"
        :items="orders"
    >
        <template slot="items" slot-scope="props">
            <td >{{ props.item.value1 }}</td>
            <td >{{ props.item.value2 }}</td>
            ...
        </template>
    </v-data-table>
Run Code Online (Sandbox Code Playgroud)

这是脚本部分:

data () {
    return {
        headers: [
            { text: 'name1', value: 'value1', ...},
            { text: 'name2', value: 'value2', ...},
            ...
        ],
        orders: ''
    }
},

mounted () {
    ApiService.orders().then(
        response => (this.orders = response.data))
}
Run Code Online (Sandbox Code Playgroud)

Jam*_*yle 5

数据表期望传递的orders变量:items="orders"是一个数组.您在此处将其定义为字符串orders: ''.您可能想要使用orders: [].