1
0
forked from x/volcanos
This commit is contained in:
shaoying 2020-09-05 07:53:33 +08:00
parent ad1b053111
commit b27799dc8b
2 changed files with 23 additions and 5 deletions

View File

@ -510,11 +510,20 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
item.value == "auto" && (item.value = "")
item.action == "auto" && (input.dataset.action = "auto")
var target = can.page.Append(can, option, [{view: ["item "+item.type], list: [item.position && {text: item.name+": "}, input]}])[item.name]
item.figure && item.figure.indexOf("@") == 0 && (item.figure = item.figure.slice(1)) && can.require(["/plugin/input/"+item.figure+".js"], function(can) {
var pval = ""
if (item.figure.indexOf("@") == 0) {
var pkey = item.figure.slice(1).split("=")[0]
if (item.figure.indexOf("=") > 0) {
var pval = item.figure.slice(1).split("=")[1]
}
}
item.figure && item.figure.indexOf("@") == 0 && (item.figure = pkey) && can.require(["/plugin/input/"+pkey+".js"], function(can) {
can.onfigure && can.core.Item(can.onfigure[item.figure], function(key, value) { if (key.startsWith("on")) {
target[key] = function(event) { value(event, can, item, target) }
} })
target.type != "button" && target.value.startsWith("@") && (target.value = "")
target.type != "button" && target.value.startsWith("@") && (target.value = pval)
})
item.type == "textarea" && can.page.Append(can, option, [{type: "br"}])

View File

@ -102,12 +102,21 @@ var user = Volcanos("user", {help: "用户模块",
item._input == "textarea"? /* textarea */ {type: "textarea", data: item}:
item._input == "select"? /* select */ {select: [[item.name].concat(item.values)], data: item}:
item._input? /* input */ {type: "input", data: (item.type = item._input, item), _init: function(target) {
var pval = ""
if (item.value && item.value.indexOf("@") == 0) {
var pkey = item.value.slice(1).split("=")[0]
if (item.value.indexOf("=") > 0) {
var pval = item.value.slice(1).split("=")[1]
}
}
if (item._input == "text" && item.value && item.value.startsWith("@")) {
can.require(["/plugin/input/"+item.value.slice(1)], function(can) {
can.core.Item(can.onfigure[item.value.slice(1)], function(key, value) { if (key.startsWith("on")) {
can.require(["/plugin/input/"+pkey], function(can) {
can.core.Item(can.onfigure[pkey], function(key, value) { if (key.startsWith("on")) {
target[key] = function(event) { value(event, can, item, target) }
} })
target.type != "button" && (target.value = "")
target.type != "button" && (target.value = pval)
})
can.page.Modify(can, target, {autocomplete: "off"})
}