🐛(component): 修复 tansfer 组件 data-source 属性缺少响应式的特性

This commit is contained in:
就眠儀式 2022-10-13 17:00:20 +08:00
parent 02facb2f01
commit a2bcc81db5
4 changed files with 19 additions and 7 deletions

View File

@ -37,9 +37,9 @@ const props = withDefaults(defineProps<LayTransferProps>(), {
const emits = defineEmits(["update:modelValue", "change"]); const emits = defineEmits(["update:modelValue", "change"]);
const leftDataSource: Ref<any[]> = ref([...props.dataSource]); const leftDataSource: Ref<any[]> = ref([]);
const rightDataSource: Ref<any[]> = ref([]); const rightDataSource: Ref<any[]> = ref([]);
const _leftDataSource: Ref<any[]> = ref([...props.dataSource]); const _leftDataSource: Ref<any[]> = ref([]);
const _rightDataSource: Ref<any[]> = ref([]); const _rightDataSource: Ref<any[]> = ref([]);
const leftSelectedKeys: Ref<string[]> = ref([]); const leftSelectedKeys: Ref<string[]> = ref([]);
const rightSelectedKeys: Ref<string[]> = ref([]); const rightSelectedKeys: Ref<string[]> = ref([]);
@ -63,7 +63,7 @@ const allLeftChange = (isChecked: boolean) => {
}; };
watch( watch(
() => props.modelValue, () => [props.modelValue, props.dataSource],
() => { () => {
let targetDataSource: any[] = []; let targetDataSource: any[] = [];

View File

@ -263,7 +263,7 @@ const filetoDataURL = (file: File, fn: Function) => {
reader.readAsDataURL(file); reader.readAsDataURL(file);
}; };
const getUploadChange = (e: any) => { const uploadChange = (e: any) => {
const files = e.target.files; const files = e.target.files;
const _files = [...files]; const _files = [...files];
if (props.multiple && props.number != 0 && props.number < _files.length) { if (props.multiple && props.number != 0 && props.number < _files.length) {
@ -363,7 +363,7 @@ onMounted(() => {
nextTick(() => { nextTick(() => {
dragRef.value.addEventListener("dragenter",dragEnter,false); dragRef.value.addEventListener("dragenter",dragEnter,false);
dragRef.value.addEventListener("dragover",dragOver,false); dragRef.value.addEventListener("dragover",dragOver,false);
dragRef.value.addEventListener("drop",getUploadChange,false); dragRef.value.addEventListener("drop",uploadChange,false);
}) })
}) })
</script> </script>
@ -383,7 +383,7 @@ onMounted(() => {
:accept="acceptMime" :accept="acceptMime"
:disabled="disabled" :disabled="disabled"
@click="clickOrgInput" @click="clickOrgInput"
@change="getUploadChange" @change="uploadChange"
/> />
<div v-if="!drag"> <div v-if="!drag">
<div class="layui-upload-btn-box" @click.stop="chooseFile"> <div class="layui-upload-btn-box" @click.stop="chooseFile">

View File

@ -23,7 +23,7 @@ export default {
setup() { setup() {
const value1 = ref(['1']); const value1 = ref(['1']);
const dataSource1 = [{id:'1', title:'易大师', disabled: true},{id:'2', title:'战争之王'}] const dataSource1 = ref([{id:'1', title:'易大师', disabled: true},{id:'2', title:'战争之王'}])
return { return {
value1, value1,

View File

@ -11,6 +11,18 @@
<template> <template>
<lay-timeline> <lay-timeline>
<lay-timeline-item title="1.6.x"> <lay-timeline-item title="1.6.x">
<ul>
<a name="1-6-7"></a>
<li>
<h3>1.6.7 <span class="layui-badge-rim">2022-10-12</span></h3>
<ul>
<li>[修复] tansfer 组件 data-source 属性缺少响应式的特性。</li>
<li>[修复] upload 组件 drag 属性开启后, 拖拽上传无效的问题。</li>
<li>[优化] switch 组件 on-switch-text 和 un-switch-text 属性, 为描述提供适当边距。</li>
<li>[优化] config-provider 组件 dark-partial 属性默认值, 降低整体饱和度。</li>
</ul>
</li>
</ul>
<ul> <ul>
<a name="1-6-6"></a> <a name="1-6-6"></a>
<li> <li>