From fcd514a4a6c6dbd56979650e995d8ffb1affeebb Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 17 Dec 2019 23:34:21 +0800 Subject: [PATCH] add detail --- frame.js | 7 ++++--- plugin/table.js | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frame.js b/frame.js index 733d12b2..74a734ac 100644 --- a/frame.js +++ b/frame.js @@ -183,7 +183,7 @@ var can = Volcanos("chat", { }) }, Show: function(type, msg, cb) {plugin.msg = msg, msg._plugin_name = name; - return plugin._output = plugin[type] = can.Output(plugin, type, msg, cb, output, option) + return plugin._output = plugin[type] = can.Output(plugin, feature, type, msg, cb, output, option) }, Clone: function(event) {meta.nick = meta.name + can.ID() can.Plugin(can, meta.nick, meta, run, @@ -215,9 +215,9 @@ var can = Volcanos("chat", { }) return input }), - Output: shy("构造组件", function(can, type, msg, cb, target, option) { + Output: shy("构造组件", function(can, feature, type, msg, cb, target, option) { if (type == "inner" && (!msg.result || msg.result.length == 0)) {type = "table"} - var output = Volcanos(type, {_type: "local", msg: msg, + var output = Volcanos(type, {_type: "local", msg: msg, feature: feature, Import: function(event, value, key) {var cb = output.onimport[key]; typeof cb == "function" && cb(event, output, value, key, target); }, @@ -227,6 +227,7 @@ var can = Volcanos("chat", { (output[cmd[1]] || can[cmd[1]] || can.Run)(event, cmd, cb, silent); }, }, Config.libs.concat(["plugin/"+type]), function(output) { + output.onimport.init(output, msg, cb, target, option); }, msg) return output.target = target, target.Output = output diff --git a/plugin/table.js b/plugin/table.js index acdce21c..360dd4f2 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -27,9 +27,13 @@ Volcanos("onimport", {help: "导入数据", list: [], switch (event.target.tagName) { case "TD": can.onimport.which(event, table, msg.append, function(index, key) { - can.user.carte(event, shy("", can.ondetail, can.ondetail.list, function(event, cmd, meta) {var cb = meta[cmd]; + can.user.carte(event, shy("", can.ondetail, can.feature.detail || can.ondetail.list, function(event, cmd, meta) {var cb = meta[cmd]; + var id = index; + msg && msg.id && (id = msg.id[index]); typeof cb == "function"? cb(event, can, msg, index, key, cmd, target): - can.run(event, [index, typeof cb == "string"? cb: cmd, key, target.innerHTML], null, true) + can.run(event, [id, typeof cb == "string"? cb: cmd, key, target.innerHTML], function(msg) { + can.onimport.init(can, msg, cb, output, option) + }, true) })) }) event.stopPropagation()