mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
-- 修改
This commit is contained in:
@@ -11,50 +11,36 @@
|
||||
style="width: 100%"
|
||||
:options="options"
|
||||
allowClear
|
||||
@change="change"
|
||||
:disabled="disabled"
|
||||
>
|
||||
</a-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: "ProjectClass",
|
||||
const store = useStore();
|
||||
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Number,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const store = useStore();
|
||||
const props = defineProps({
|
||||
value: String,
|
||||
disabled: String
|
||||
})
|
||||
const emit = defineEmits({})
|
||||
|
||||
const state = reactive({
|
||||
options: [],
|
||||
id: props.modelValue
|
||||
});
|
||||
const options = ref([])
|
||||
|
||||
watch(props, () => {
|
||||
if (props.modelValue !== state.id) {
|
||||
state.id = props.modelValue
|
||||
}
|
||||
})
|
||||
|
||||
watch(state.id,()=>{
|
||||
ctx.emit('update:modelValue',state.id)
|
||||
})
|
||||
const id = computed(() => {
|
||||
return props.value
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
options.value = store.state.projectClass.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
|
||||
})
|
||||
|
||||
function change(key, obj) {
|
||||
emit('update:name', obj[0])
|
||||
emit('update:value', key)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
state.options = store.state.projectClass.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
|
||||
})
|
||||
return {
|
||||
...toRefs(state),
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user