单击“流行”时,如何用新查询(getPopular)的结果替换内容?
( v-for="casino in allCasinos" 需要改为显示: v-for="casino in getPopular" )
<div @click="activate(1); getPopular();">Popular</div>
<div @click="activate(2); getNew();">New</div>
<div id="list" v-for="casino in allCasinos" :key="casino.name">
<div v-if="$apollo.loading">Loading...</div>
<div>{{ casino.name}}</div>
</div>
<script>
import gql from 'graphql-tag';
methods: {
activate:function(el){
this.active_el = el;
},
},
apollo: {
allCasinos: gql`{
allCasinos(limit: 6) {
name,
}
}`,
getPopular: gql`{
getPopular(limit: 6) {
name,
}
}`,
getNew gql`{
getNew(limit: 6) {
name,
}
}`,
</script>