vue點(diǎn)擊Dashboard不同內(nèi)容 跳轉(zhuǎn)到同一表格的實(shí)例
1.點(diǎn)擊跳轉(zhuǎn)寫(xiě)法
點(diǎn)擊頁(yè)面內(nèi)容:優(yōu)先級(jí)
<router-link :to='{ path: "/cases/case",query: { priorityId: 0 ,type:"priorityId"}}' style="color: #515a6e;">優(yōu)先級(jí)</router-link>
點(diǎn)擊頁(yè)面內(nèi)容:狀態(tài)
<router-link :to='{ path: "/cases/case",query: { status: 0 ,type:"status"}}' style="color: #515a6e;">狀態(tài)</router-link>
點(diǎn)擊echarts柱狀
this.chartEvent.on('click',function (param) {
that.$router.push({
path: '/cases/case',
query: { createdTime: param.name,type:"createdTime" }
});
})
2.表格分頁(yè)寫(xiě)法(不同跳轉(zhuǎn) 顯示不同傳參)
注:由于該頁(yè)面下拉框也有相應(yīng)的優(yōu)先級(jí)篩選條件 所有寫(xiě)了兩層if判斷了一下
getData: function(){
//獲取CaseSearch里面的搜索內(nèi)容
eventBus.$on('ticketEntityId',function(val){
tableCaseVue.ticketEntityId=val;
})
eventBus.$on('companyId',function(val){
tableCaseVue.companyId=val;
})
eventBus.$on('priorityId',function(val){
tableCaseVue.priorityId=val;
})
eventBus.$on('status',function(val){
tableCaseVue.status=val;
})
eventBus.$on('ticketCategory',function(val){
tableCaseVue.ticketCategory=val;
})
var pageTicketDate = {
"pageNum": this.current,
"pageSize": this.pageSize,
"priorityId":tableCaseVue.priorityId,
"status":tableCaseVue.status,
"ticketEntityId":tableCaseVue.ticketEntityId,
"companyId":tableCaseVue.companyId,
"ticketCategory":tableCaseVue.ticketCategory
};
// 優(yōu)先級(jí)
if((this.$route.query.type == 'priorityId')&&(pageTicketDate.priorityId=='')){
pageTicketDate.priorityId=this.$route.query.priorityId;
}
// 狀態(tài)
if((this.$route.query.type == 'status')&&(pageTicketDate.status=='')){
pageTicketDate.status=this.$route.query.status;
}
//創(chuàng)建時(shí)間
if (this.$route.query.type == 'createdTime') {
pageTicketDate.createdTime = this.$route.query.createdTime;
}
//當(dāng)前月
if (this.$route.query.type == 'currentMonth') {
pageTicketDate.currentMonth = this.$route.query.currentMonth;
}
if(pageTicketDate.ticketEntityId||pageTicketDate.companyId||pageTicketDate.priorityId||pageTicketDate.status||pageTicketDate.ticketCategory){
pageTicketDate.ticketEntityId=tableCaseVue.ticketEntityId;
pageTicketDate.companyId=tableCaseVue.companyId;
pageTicketDate.priorityId=tableCaseVue.priorityId;
pageTicketDate.status=tableCaseVue.status;
pageTicketDate.ticketCategory=tableCaseVue.ticketCategory;
pageTicketDate.createdTime='';
pageTicketDate.currentMonth='';
}
this.$api.ticket.pageTicket(pageTicketDate)
.then(res => {
this.tableCaseDate = res.data.records;
for(var i=0;i<this.tableCaseDate.length;i++){
// 響應(yīng)時(shí)間
if(this.tableCaseDate[i].waitTime!=undefined){
this.tableCaseDate[i].waitTime=this.tableCaseDate[i].waitTime+'分鐘';
}
// 處理時(shí)間
if(this.tableCaseDate[i].handleTime!=undefined){
this.tableCaseDate[i].handleTime=this.tableCaseDate[i].handleTime+'分鐘';
}
// 完成時(shí)間
if(this.tableCaseDate[i].finishTime!=undefined){
this.tableCaseDate[i].finishTime=this.tableCaseDate[i].finishTime;
}else{
this.tableCaseDate[i].finishTime='N/A';
}
}
// 當(dāng)前頁(yè)
this.current = res.data.current;
// 總條數(shù)
this.dataTotal = res.data.total;
});
}
補(bǔ)充知識(shí):vue點(diǎn)擊跳轉(zhuǎn)到詳情頁(yè)
1商品組件頁(yè)面GoodsInfo.vue(點(diǎn)擊該組件跳轉(zhuǎn)到詳情頁(yè))
<template>
<div class="goods-info" @click="goGoodsPage()">
<div class="goods-image">
<img v-lazy="goodsImage">
</div>
<div class="goods-name">{{goodsName}}</div>
<div class="goods-price">¥{{ goodsPrice.toFixed(2) }}</div>
</div>
</template>
<script>
export default {
name: "goodsInfo",
// 首頁(yè)傳過(guò)來(lái)的
props: ["goodsImage", "goodsName", "goodsPrice", "goodsId"],
data() {
return {};
},
methods: {
goGoodsPage() {
// 跳轉(zhuǎn)到Goods.vue商品詳情頁(yè)面,name為Goods.vue頁(yè)面路由配置里的的name屬性
this.$router.push({name:"goods",query:{goodsId:this.goodsId}})
}
}
};
</script>
<style lang="scss" scoped>
.goods-info {
padding-bottom: 0.2rem;
.goods-image {
text-align: center;
img{
width: 95%;vertical-align: middle;
}
}
.goods-name {
padding: 0 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.goods-price {
text-align: center;
color: #e5017d;
}
}
</style>
2商品詳情頁(yè)面Goods.vue(接收商品組件頁(yè)面GoodsInfo.vue傳過(guò)來(lái)的goodsId)
<template>
<div>商品詳情頁(yè)</div>
</template>
<script>
import url from "@/urlApi.js";
export default {
name: "goods",
data() {
return {
goodsId: ""
};
},
created () {
// 接收GoodsInfo.vue傳過(guò)來(lái)的goodsId
this.goodsId = this.$route.query.goodsId
console.log(this.goodsId)
this.getGoodsInfo();
},
methods: {
getGoodsInfo() {
let that = this;
this.$http
.post(url.getDetailGoodsInfo,{goodsId: that.goodsId})
.then(response => {
//根據(jù)goodsId獲取對(duì)應(yīng)的商品詳情信息
console.log(response)
})
.catch(error => {
});
}
}
};
</script>
<style lang="scss" scoped>
</style
以上這篇vue點(diǎn)擊Dashboard不同內(nèi)容 跳轉(zhuǎn)到同一表格的實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vue?nextTick獲取更新后的DOM的實(shí)現(xiàn)
本文主要介紹了Vue?nextTick獲取更新后的DOM的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-01-01
vue+iview/elementUi實(shí)現(xiàn)城市多選
這篇文章主要介紹了vue+iview/elementUi實(shí)現(xiàn)城市多選,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-03-03
axios上傳文件錯(cuò)誤:Current?request?is?not?a?multipart?request
最近工作中使用vue上傳文件的時(shí)候遇到了個(gè)問(wèn)題,下面這篇文章主要給大家介紹了關(guān)于axios上傳文件錯(cuò)誤:Current?request?is?not?a?multipart?request解決的相關(guān)資料,需要的朋友可以參考下2023-01-01
Vue前端登錄token信息驗(yàn)證功能實(shí)現(xiàn)
最近公司新啟動(dòng)了個(gè)項(xiàng)目,用的是vue框架在做,下面這篇文章主要給大家介紹了關(guān)于vue實(shí)現(xiàn)token登錄驗(yàn)證的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-12-12
element中table高度自適應(yīng)的實(shí)現(xiàn)
這篇文章主要介紹了element中table高度自適應(yīng)的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-10-10
vue3一個(gè)元素如何綁定兩個(gè)或多個(gè)事件
這篇文章主要介紹了vue3一個(gè)元素如何綁定兩個(gè)或多個(gè)事件問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-11-11
VUE中v-on:click事件中獲取當(dāng)前dom元素的代碼
這篇文章主要介紹了VUE中v-on:click事件中獲取當(dāng)前dom元素的代碼,文中同時(shí)給大家提到了v-on:click獲取當(dāng)前事件對(duì)象元素的方法,需要的朋友可以參考下2018-08-08

