【发布时间】:2019-09-06 13:51:49
【问题描述】:
我尝试创建一个 v-data-table 包括,以便我可以使用按钮添加另一个字段,但它似乎不起作用。
代码如下: https://codepen.io/gerak/pen/yLBpqqG
问题是当我将包 https://cdnjs.cloudflare.com/ajax/libs/vuetify/1.5.14/vuetify.min.js 更改为像这样的最新版本时: https://cdnjs.cloudflare.com/ajax/libs/vuetify/2.0.15/vuetify.min.js 表忽略标签。
HTML
<v-app id="inspire">
<v-data-table
:headers="headers"
:items="desserts"
class="elevation-1"
>
<template v-slot:items="props">
<td>{{ props.item.name }}</td>
<td >{{ props.item.calories }}</td>
<td>{{ props.item.fat }}</td>
<td><v-btn>Created Button</v-btn></td>
</template>
</v-data-table>
</v-app>
</div>
JS
new Vue({
el: '#app',
data () {
return {
headers: [
{
text: 'Dessert (100g serving)',
align: 'left',
sortable: false,
value: 'name'
},
{ text: 'Calories', value: 'calories' },
{ text: 'Fat (g)', value: 'fat' },
{ text: 'Button field', value: 'buttonField' },
],
desserts: [
{
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
},
{
name: 'Ice cream sandwich',
calories: 237,
fat: 9.0,
},
{
name: 'Eclair',
calories: 262,
fat: 16.0,
}
]
}
}
})
我没有收到任何错误,只有表格停止出现。会不会是版本问题?
【问题讨论】:
-
如果我将您的 codepen 更改为使用 2.0.15,我会在控制台中看到错误您是否也更改了 css?这似乎并不重要。
标签: javascript vue.js vuetify.js