fix: bug修改
This commit is contained in:
@@ -14,6 +14,7 @@ export const treeProps = {
|
||||
type: [String, Object, Function] as PropType<string | Function | AxiosRequestConfig>,
|
||||
default: undefined,
|
||||
},
|
||||
treeData: PropTypes.array.def([]),
|
||||
params: PropTypes.object.def(() => ({})),
|
||||
dynamicParams: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
|
@@ -21,7 +21,7 @@
|
||||
</a-spin>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, reactive, ref, unref, useAttrs } from 'vue';
|
||||
import { computed, nextTick, reactive, ref, unref, useAttrs, watch } from 'vue';
|
||||
import { TreeDataItem } from 'ant-design-vue/es/tree/Tree';
|
||||
import { useApi } from '/nerv-lib/use/use-api';
|
||||
import { AxiosRequestConfig } from 'axios';
|
||||
@@ -33,16 +33,28 @@
|
||||
defineOptions({
|
||||
name: 'NsTreeApi',
|
||||
});
|
||||
const emit = defineEmits(['update:treeData']);
|
||||
// const model = defineModel('treeData');
|
||||
|
||||
const formElRef = ref();
|
||||
const props = defineProps(treeProps);
|
||||
const treeData = ref<TreeDataItem[]>([]);
|
||||
|
||||
const treeData = ref(props.treeData);
|
||||
const selectedKeys = ref(props.selectedKeys || []);
|
||||
const { httpRequest } = useApi();
|
||||
const requestConfig: AxiosRequestConfig = { method: 'get' };
|
||||
const route = useRoute();
|
||||
const attrs = useAttrs();
|
||||
const formModel = reactive({});
|
||||
watch(
|
||||
() => props.treeData,
|
||||
(val) => {
|
||||
treeData.value = val;
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
const treeState = reactive({
|
||||
loading: false,
|
||||
});
|
||||
@@ -56,6 +68,7 @@
|
||||
return props.isSticky ? 'sticky' : 'static';
|
||||
});
|
||||
const formFinish = debounce((data: object) => {
|
||||
selectedKeys.value = [];
|
||||
getData(data);
|
||||
}, 200);
|
||||
const getBindValue = computed(() => ({
|
||||
@@ -83,6 +96,8 @@
|
||||
})
|
||||
.then((res) => {
|
||||
treeData.value = transform(get(res, resultField));
|
||||
emit('update:treeData', treeData.value);
|
||||
// model.value = treeData.value;
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
|
Reference in New Issue
Block a user