1
0
forked from x/volcanos
This commit is contained in:
harveyshao 2022-01-22 13:51:07 +08:00
parent fce46d83ae
commit fb53df69a3
2 changed files with 6 additions and 4 deletions

View File

@ -335,13 +335,15 @@ Volcanos("page", {help: "用户界面", ClassList: {
input.style.height = input.style.height||can.Conf(["feature", html.TEXTAREA, item.name, html.HEIGHT].join(ice.PT))||can.Conf(["feature", html.TEXTAREA, html.HEIGHT].join(ice.PT)) input.style.height = input.style.height||can.Conf(["feature", html.TEXTAREA, item.name, html.HEIGHT].join(ice.PT))||can.Conf(["feature", html.TEXTAREA, html.HEIGHT].join(ice.PT))
input.style.width = input.style.width||can.Conf(["feature", html.TEXTAREA, item.name, html.WIDTH].join(ice.PT))||can.Conf(["feature", html.TEXTAREA, html.WIDTH].join(ice.PT)) input.style.width = input.style.width||can.Conf(["feature", html.TEXTAREA, item.name, html.WIDTH].join(ice.PT))||can.Conf(["feature", html.TEXTAREA, html.WIDTH].join(ice.PT))
// no break // no break
case html.USERNAME:
case html.PASSWORD: case html.PASSWORD:
// no break // no break
case html.TEXT: case html.TEXT:
if (item.username) { item.type = html.TEXT; return item }
if (item.password) { return item }
item.autocomplete = "off" item.autocomplete = "off"
item.name = item.name||item.type
item.value = value||item.value||"" item.value = value||item.value||""
item.placeholder = item.placeholder||item.name||item.type
item.title = item.title||item.placeholder||item.name||item.type
item.className || can.page.ClassList.add(can, item, ctx.ARGS) item.className || can.page.ClassList.add(can, item, ctx.ARGS)
break break
case html.SELECT: input.type = html.SELECT case html.SELECT: input.type = html.SELECT

View File

@ -125,7 +125,7 @@ Volcanos("user", {help: "用户操作", agent: {
}, },
login: function(can, cb, method) { login: function(can, cb, method) {
var ui = can.user.input({}, can, [ var ui = can.user.input({}, can, [
{username: html.USERNAME}, {password: html.PASSWORD}, {type: html.USERNAME}, {type: html.PASSWORD},
], function(event, button, data, list) { return { ], function(event, button, data, list) { return {
"登录": function() { "登录": function() {
can.run({}, [aaa.LOGIN, data[html.USERNAME], data[html.PASSWORD]], function(msg) { can.run({}, [aaa.LOGIN, data[html.USERNAME], data[html.PASSWORD]], function(msg) {
@ -235,7 +235,7 @@ Volcanos("user", {help: "用户操作", agent: {
can.page.Modify(can, ui._target, {style: {left: event.clientX, top: event.clientY}}) can.page.Modify(can, ui._target, {style: {left: event.clientX, top: event.clientY}})
}, },
input: function(event, can, form, cb, button) { if (!form || form.length == 0) { return cb()} input: function(event, can, form, cb, button) { if (!form || form.length == 0) { return cb() }
var msg = can.request(event) var msg = can.request(event)
var ui = can.page.Append(can, document.body, [{view: [html.INPUT], style: {left: 0, top: 0}, list: [ var ui = can.page.Append(can, document.body, [{view: [html.INPUT], style: {left: 0, top: 0}, list: [
{view: [chat.OPTION, html.TABLE], list: can.core.List(form, function(item) { {view: [chat.OPTION, html.TABLE], list: can.core.List(form, function(item) {