From 54e91096d6fea8f55e15bba962d1b9bf647795ea Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 17 Nov 2020 21:32:24 +0800 Subject: [PATCH] opt some --- frame.js | 2 +- lib/user.js | 1 + plugin/input/key.js | 1 + plugin/table.js | 8 +++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frame.js b/frame.js index d50500d6..8d8a78a1 100644 --- a/frame.js +++ b/frame.js @@ -171,8 +171,8 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta, {name: "tmux", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/tmux/tmux.shy"]}, {name: "git", help: "代码库", index: "web.wiki.word", args: ["usr/icebergs/misc/git/git.shy"]}, {name: "vim", help: "编辑器", index: "web.wiki.word", args: ["usr/icebergs/misc/vim/vim.shy"]}, - {name: "ssh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/base/ssh/ssh.shy"]}, {name: "zsh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/zsh.shy"]}, + {name: "ssh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/base/ssh/ssh.shy"]}, ]}, "web": {name: "网页 web", action: [ {name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]}, diff --git a/lib/user.js b/lib/user.js index 79d661be..137d336d 100644 --- a/lib/user.js +++ b/lib/user.js @@ -135,6 +135,7 @@ var user = Volcanos("user", {help: "用户模块", agent: { if (item.value.indexOf("=") > 0) { var pval = item.value.slice(1).split("=")[1] } + item._action = msg.Option("action") target.type != "button" && (target.value = pval || msg.Option(item.name)) can.page.Modify(can, target, {autocomplete: "off"}) diff --git a/plugin/input/key.js b/plugin/input/key.js index cbe753b4..fc9104e1 100644 --- a/plugin/input/key.js +++ b/plugin/input/key.js @@ -7,6 +7,7 @@ Volcanos("onfigure", {help: "控件详情", list: [], _init: function(can, item, }, key: {onclick: function(event, can, item, target) { function run() { var msg = can.request(event); msg.Option(can.Option()) + msg.Option("action", item._action) can.run(event, ["action", "inputs", item.name, target.value], function(msg) { if (!msg.append) { return } diff --git a/plugin/table.js b/plugin/table.js index 9309d4a1..78cf0b27 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -32,7 +32,6 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, } }, can.ui.display) - can.onappend.board(can, msg, can.ui.display, "board") can.onimport._board(can, msg) return typeof cb == "function" && cb(msg) @@ -97,6 +96,8 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, if (target.tagName == "INPUT" && target.type == "button") { var msg = can.sup.request(event); msg.Option(can.Option()) key == "value"? can.core.List(array, function(item, index) { msg.Option(item.key, item.value) }): msg.Option(line) + var msg = can.request(event) + msg.Option("action", target.name) var cb = can.onaction[target.name]; return typeof cb == "function"? cb(event, can, target.name): can.sup.onaction.input(event, can.sup, target.name, function(msg) { can.user.toast(can, msg.Result()) @@ -162,9 +163,14 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, return true }, _inner: function(can, msg) { + can.onappend.table(can, msg, can.ui.display, "table", function(value, key, index, line, array) { + return can.onimport._table(can, value, key, index, line, array) + }) + can.onappend.board(can, msg, can.ui.display, "board") can.onimport._board(can, msg) return true + }, _field: function(can, msg) { msg.Table(function(value) {