From 1594942f2cbe58dad042e2bbd431f0f2edc002a2 Mon Sep 17 00:00:00 2001 From: leonine <326026108@qq.com> Date: Wed, 15 Feb 2017 16:04:35 +0800 Subject: [PATCH] itable 添加设置默认选中行的功能 --- src/components/table/table.vue | 6 +++++- test/routers/table.vue | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/components/table/table.vue b/src/components/table/table.vue index 0898092..bbd73cc 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -548,7 +548,11 @@ this.data.forEach((row, index) => { const newRow = deepCopy(row);// todo 直接替换 newRow._isHover = false; - newRow._isChecked = false; + if(newRow.checked){// 传checked:true 可以设置该行为默认选中状态 + newRow._isChecked = newRow.checked; + }else{ + newRow._isChecked = false; + } newRow._isHighlight = false; data[index] = newRow; }); diff --git a/test/routers/table.vue b/test/routers/table.vue index 101cd12..99b2926 100644 --- a/test/routers/table.vue +++ b/test/routers/table.vue @@ -1,5 +1,8 @@