为什么这些vuetify数据表插槽不起作用?

时间:2020-06-23 20:47:41

标签: vue.js vuetify.js

我正在使用vuetify数据表

<v-data-table
                :headers="fields"
                :items="items"
                :search="search"
                :mobile-breakpoint="NaN"
                fixed-header
                :loading="isBusy"
            >
                <template v-slot:item="{item,headers}">
                    <tr>
                        <td
                            v-for="(header, index) in headers"
                            :key="index"
                        >{{ header.formatFn(item[header.value]) }}</td>
                    </tr>
                </template>
                <template v-slot:item.userid="{ item }">Abc{{item}}</template>
                <v-alert
                    slot="no-results"
                    :value="true"
                    color="error"
                    icon="warning"
                >Your search for "{{ search }}" found no results.</v-alert>

                <template slot="no-data">No Data Exists!</template>
            </v-data-table>

下面的插槽template v-slot:item.userid="{ item }">Abc{{item}}</template>由于任何我无法弄清的原因而无法正常工作

我的fields数组中存在一个字段“ userid”。

1 个答案:

答案 0 :(得分:0)

好吧,当我找到解决方法的时候,它就起作用了

import random

print(f"u{random.randint(1, 4)} is P1")