功能变化: 优化dept-format
parent
b54017889e
commit
4c75f010f8
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
{{$store.state.d2admin.dept.data[currentValue] || ''}}
|
{{currentValue}}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -24,21 +24,20 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value (value) {
|
value () {
|
||||||
// this.$emit('change', value)
|
this.setValue()
|
||||||
if (this.currentValue === value) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setValue(value)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.setValue(this.value)
|
this.setValue(this.value)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setValue (value) {
|
async setValue () {
|
||||||
// 在这里对 传入的value值做处理
|
// 在这里对 传入的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 递归获取对应的名称
|
// 根据值的key 递归获取对应的名称
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue