This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/common/mixin/detailViewLeftMixin.js
2021-10-13 18:24:09 +08:00

70 lines
1.3 KiB
JavaScript

export default {
props: {
tableData: {
type: Array
},
api: {
type: String
},
tableId: {
type: String
},
detailViewRightObj: {},
orderByFa: {}
},
data () {
return {
orderBy: '',
orderType: 'ascending',
renderFirst: ''
}
},
methods: {
detailViewRightShow (item) {
this.$emit('detailViewRightShow', item)
},
orderTypeChange () {
if (this.orderType === 'ascending') {
this.orderType = 'descending'
} else {
this.orderType = 'ascending'
}
}
},
watch: {
orderByFa: {
immediate: true,
handler (n) {
console.log(n)
const index = n.indexOf('-')
this.renderFirst = false
if (index !== -1) {
this.orderBy = n.slice(index + 1)
this.orderType = 'descending'
} else {
this.orderBy = n
this.orderType = 'ascending'
}
setTimeout(() => {
this.renderFirst = true
})
}
},
orderBy: {
handler (n) {
console.log(n)
if (this.renderFirst) {
this.$emit('orderDetail', this.orderBy, this.orderType)
}
}
},
orderType: {
handler (n) {
if (this.renderFirst) {
this.$emit('orderDetail', this.orderBy, n)
}
}
}
}
}