<div class="tips">
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="排序方式" name="three" :disabled="true" style="color: #2C3E50;"></el-tab-pane>
<el-tab-pane label="销量" name="first"></el-tab-pane>
<el-tab-pane name="second" :disabled="true">
<span slot="label">
<el-dropdown>
<span class="el-dropdown-link">
{{title}}<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="getQuest">由高到低</el-dropdown-item>
<el-dropdown-item @click.native="getQuest2">由低到高</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</el-tab-pane>
</el-tabs>
</div>
activeName: 'first', //tab
orderBy: [],
title: "价格"
//tab
handleClick(tab, event) {
if (tab.name == 'second') {
} else if (tab.name == 'first') {
this.orderBy = []
//要传给后台的排序数组
this.orderBy.push('sales', 'desc')
//后台接口调用
this.getTopList()
}
},
//由高到低
getQuest() {
this.activeName='second'
this.title='价格由高到低'
this.orderBy = []
this.orderBy.push('price', 'desc')
this.getTopList()
},
getQuest2() {
this.activeName='second'
this.title='价格由低到高'
this.orderBy = []
this.orderBy.push('price', 'asc')
this.getTopList()
},