功能变化: 优化dept-format

v2.x
李强 2023-03-18 23:30:14 +08:00
parent b54017889e
commit 4c75f010f8
1 changed files with 8 additions and 9 deletions

View File

@ -1,6 +1,6 @@
<template>
<div>
{{$store.state.d2admin.dept.data[currentValue] || ''}}
{{currentValue}}
</div>
</template>
<script>
@ -24,21 +24,20 @@ export default {
}
},
watch: {
value (value) {
// this.$emit('change', value)
if (this.currentValue === value) {
return
}
this.setValue(value)
value () {
this.setValue()
}
},
created () {
this.setValue(this.value)
},
methods: {
setValue (value) {
async setValue () {
// value
this.currentValue = String(this.value)
if (!this.$store.state.d2admin.dept.data) {
await this.$store.dispatch('d2admin/dept/load')
}
this.currentValue = this.$store.state.d2admin.dept.data[String(this.value)]
// key
}
}