博客 / 詳情

返回

vxe-table 單選設置允許取消選中

vxe-table 單選設置允許取消選中,通過設置 radio-row-config.strict=false 允許取消選中

https://vxetable.cn

Video_2026-03-09_104017-ezgif.com-video-to-gif-converter

設置 radio-row-config.strict=false 允許取消選中

<template>
  <div>
    <vxe-grid v-bind="gridOptions"></vxe-grid>
  </div>
</template>

<script>
export default {
    data() {
        const gridOptions = {
            border: true,
            height: 300,
            rowConfig: {
                isHover: true
            },
            radioConfig: {
                labelField: 'name',
                strict: false
            },
            columns: [
                { type: 'radio', title: 'Name', width: 300 },
                { field: 'id', title: 'ID' },
                { field: 'age', title: 'Age' },
                { field: 'address', title: 'Address', showOverflow: true }
            ],
            data: [
                { id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
                { id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
                { id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
                { id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 23, address: 'test abc' },
                { id: 10005, name: 'Test5', role: 'Develop', sex: 'Women', age: 30, address: 'Shanghai' }
            ]
        };
        return {
            gridOptions
        };
    }
};
</script>

https://gitee.com/x-extends/vxe-table

user avatar
0 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.