🐛(component): table 组件 selected-keys 属性 watch 需要 deep 监听
This commit is contained in:
parent
6c984ca3cc
commit
1010a4bbed
@ -68,13 +68,14 @@ const changeAll = function (checked: any) {
|
|||||||
const ids = props.dataSource.map((item: any) => {
|
const ids = props.dataSource.map((item: any) => {
|
||||||
return item[props.id];
|
return item[props.id];
|
||||||
});
|
});
|
||||||
tableSelectedKeys.value.splice(0, ids.length);
|
let arr = [...tableSelectedKeys.value];
|
||||||
|
arr.splice(0, ids.length);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
ids.forEach((id) => {
|
ids.forEach((id) => {
|
||||||
tableSelectedKeys.value.push(id);
|
arr.push(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
emit("update:selectedKeys", tableSelectedKeys.value);
|
tableSelectedKeys.value = arr;
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -237,7 +237,7 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
@ -287,6 +287,10 @@ export default {
|
|||||||
console.log(JSON.stringify(data))
|
console.log(JSON.stringify(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(selectedKeys5, () => {
|
||||||
|
console.log("复选框监听:" + selectedKeys5.value);
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
columns5,
|
columns5,
|
||||||
dataSource5,
|
dataSource5,
|
||||||
|
Loading…
Reference in New Issue
Block a user