-- 修改

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

@@ -9,42 +9,34 @@
:options="options"
style="width: 100%"
placeholder="请选择项目级别"
@change="change"
:disabled="disabled"
/>
</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: "ProjectClass",
props: {
modelValue: {
type: Number,
},
disabled: {
type: Boolean,
default: false
},
},
setup(props, ctx) {
const store = useStore();
const store = useStore();
const props = defineProps({
value: String,
disabled: String
})
const state = reactive({
options: [],
id: props.modelValue
});
watch(state.id, () => {
ctx.emit('update:modelValue', state.id)
})
const id = computed(() => {
return props.value
})
onMounted(() => {
state.options = store.state.projectLevel.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
})
return {
...toRefs(state),
};
},
};
const emit = defineEmits({})
const options = ref([])
onMounted(() => {
options.value = store.state.projectLevel.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
})
function change(key) {
emit('update:value', key)
}
</script>