-- 修改

This commit is contained in:
yuping
2022-12-04 02:35:38 +08:00
parent c2692a615c
commit 8af9e5e53f
7 changed files with 227 additions and 145 deletions

View File

@@ -22,55 +22,30 @@
>
</a-tree-select>
</template>
<script>
import {onMounted, reactive, toRefs, watch} from "vue";
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref} from "vue";
import {useStore} from "vuex";
export default {
name: "OrgClass",
const store = useStore();
props: {
value: {
type: String,
},
name: {
type: String,
},
disabled: {
type: Boolean,
default: false
},
},
setup(props, ctx) {
const store = useStore();
const props = defineProps({
value: String
})
const emit = defineEmits({})
const state = reactive({
options: [],
id: props.value+''
});
const options = ref([])
watch(props, () => {
console.log('props', state)
console.log('props', props)
if ((props.value + '') !== state.id) {
state.id = props.value + ''
}
})
onMounted(() => {
state.options = [...store.state.orgtreeList]
console.log(state.options)
})
const id = computed(() => {
return props.value
})
function change(key, obj) {
console.log(state)
ctx.emit('update:name', obj[0])
ctx.emit('update:value', key + '')
}
onMounted(() => {
options.value = [...store.state.orgtreeList]
})
function change(key, obj) {
emit('update:name', obj[0])
emit('update:value', key)
}
return {
...toRefs(state),
change
};
},
};
</script>