【发布时间】:2019-01-26 12:08:26
【问题描述】:
我需要向VuetifyJS list 添加一个简单的搜索和排序功能。 这是列表的 CodePen 示例:https://codepen.io/anon/pen/bxGGgv
在 VueJS 2 中执行此操作的标准方法是什么?
HTML:
<v-list two-line>
<template v-for="(item, index) in items">
<v-list-tile
:key="item.title"
avatar
ripple
@click="toggle(index)"
>
<v-list-tile-content>
<v-list-tile-title>{{ item.title }}</v-list-tile-title>
<v-list-tile-sub-title class="text--primary">
{{ item.headline }}
</v-list-tile-sub-title>
<v-list-tile-sub-title>{{ item.subtitle }}</v-list-tile-sub-title>
</v-list-tile-content>
</v-list-tile>
<v-divider
v-if="index + 1 < items.length"
:key="index"
></v-divider>
</template>
</v-list>
JS:
export default {
data () {
return {
selected: [2],
items: [
{
action: '15 min',
headline: 'Brunch this weekend?',
title: 'Ali Connors',
subtitle: "I'll be in your neighborhood doing errands this weekend. Do you want to hang out?"
},
{
action: '18hr',
headline: 'Recipe to try',
title: 'Britta Holt',
subtitle: 'We should eat this: Grate, Squash, Corn, and tomatillo Tacos.'
}
]
}
},
}
【问题讨论】:
标签: javascript search vue.js vuejs2 vuetify.js