add multi-line string support

This commit is contained in:
hyb1996
2017-05-15 19:47:58 +08:00
parent 8ac9a518d7
commit 91a1cb77d8
9 changed files with 312 additions and 18 deletions

View File

@@ -0,0 +1,58 @@
"ui";
ui.statusBarColor("#000000")
showLoginUI();
//显示登录界面
function showLoginUI(){
ui.layout(`
<frame>
<vertical h="auto" align="center" margin="0 50">
<linear>
<text w="56" gravity="center" color="#111" size="16">用户名</text>
<input id="name" w="*" h="40"/>
</linear>
<linear>
<text w="56" gravity="center" color="#111" size="16">密码</text>
<input id="password" w="*" h="40" inputType="password"/>
</linear>
<linear gravity="center">
<button id="login" text="登录"/>
<button id="register" text="注册"/>
</linear>
</vertical>
</frame>
`);
ui.login.click(() => {
toast("您输入的用户名为" + ui.name.text() + " 密码为" + ui.password.text());
});
ui.register.click(() => showRegisterUI());
}
//显示注册界面
function showRegisterUI(){
ui.layout(`
<frame>
<vertical h="auto" align="center" margin="0 50">
<linear>
<text w="56" gravity="center" color="#111" size="16">用户名</text>
<input w="*" h="40"/>
</linear>
<linear>
<text w="56" gravity="center" color="#111" size="16">密码</text>
<input w="*" h="40" inputType="password"/>
</linear>
<linear>
<text w="56" gravity="center" color="#111" size="16">邮箱</text>
<input w="*" h="40" inputType="email"/>
</linear>
<linear gravity="center">
<button>确定</button>
<button id="cancel">取消</button>
</linear>
</vertical>
</frame>
`);
ui.cancel.click(() => showLoginUI());
}