From 43d513d9a8de4619ffc67af8f46fc187b66c49b7 Mon Sep 17 00:00:00 2001 From: shaoying Date: Thu, 20 Feb 2020 10:45:38 +0800 Subject: [PATCH] opt some --- plugin/table.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugin/table.js b/plugin/table.js index bba515f8..636fb487 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -1,10 +1,5 @@ Volcanos("onimport", {help: "导入数据", list: [], init: function(can, msg, cb, output, action, option) {output.innerHTML = ""; - if (!msg.append || msg.append.length == 0) { - var code = can.page.Append(can, output, [{view: ["code", "div", can.page.Display(msg.Result())]}]).code; - return typeof cb == "function" && cb(msg), code; - } - var table = can.page.AppendTable(can, output, msg, msg.append); table.onclick = function(event) {switch (event.target.tagName) { case "TD": @@ -40,7 +35,9 @@ Volcanos("onimport", {help: "导入数据", list: [], case "TABLE": } } - return typeof cb == "function" && cb(msg), table; + + var code = can.page.Append(can, output, [{view: ["code", "div", can.page.Display(msg.Result())]}]).code; + return typeof cb == "function" && cb(msg), code; }, which: function(event, table, list, cb) {if (event.target == table) {return cb(-1, "")} can.page.Select(can, table, "tr", function(tr, index) {if (event.target == tr) {return cb(tr.dataset.index, "")}