Skip to content

Commit

Permalink
feat: form
Browse files Browse the repository at this point in the history
  • Loading branch information
uxsi committed Aug 21, 2019
1 parent 5a0bee8 commit 59ac11f
Show file tree
Hide file tree
Showing 11 changed files with 433 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/example/example.css

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions dist/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ <h1 class="page__title">
</div>
<div class="weui-cell__ft"></div>
</a>
<a class="weui-cell weui-cell_access js_item" data-id="form" href="javascript:;">
<div class="weui-cell__bd">
<p>Form</p>
</div>
<div class="weui-cell__ft"></div>
</a>
<a class="weui-cell weui-cell_access js_item" data-id="list" href="javascript:;">
<div class="weui-cell__bd">
<p>List</p>
Expand Down Expand Up @@ -675,6 +681,92 @@ <h1 class="page__title">Input</h1>
});
});
</script>
</script>
<script type="text/html" id="tpl_form">
<div class="page">
<div class="weui-form">
<div class="weui-form__text-area">
<h2 class="weui-form__title">表单标题</h2>
<div class="weui-form__desc">表单描述示意</div>
</div>
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">输入框</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">QQ号</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入QQ号"/>
</div>
</div>
</div>
</div>
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">验证码</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入手机号"/>
</div>
</div>
<div class="weui-cell weui-cell_vcode">
<div class="weui-cell__hd"><label class="weui-label">验证码</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder=""/>
</div>
<div class="weui-cell__ft">
<button class="weui-btn weui-btn_default weui-vcode-btn">获取验证码</button>
</div>
</div>
</div>
<div class="weui-cells__tips"><a href="javascript:;">收不到验证码</a></div>
</div>
</div>
<div class="weui-form__tips-area">
<label for="weuiAgree" class="weui-agree">
<input id="weuiAgree" type="checkbox" class="weui-agree__checkbox"/>
<span class="weui-agree__text">
阅读并同意<a href="javascript:void(0);">《相关条款》</a>
</span>
</label>
</div>
<div class="weui-form__opr-area">
<a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips">确定</a>
</div>
<div class="weui-form__tips-area">
<p class="weui-form__tips">
点击下一步即表示<a href="javascript:;">同意用户协议</a>
</p>
</div>
<div class="weui-form__extra-area">
<div class="weui-footer">
<p class="weui-footer__links">
<a href="javascript:void(0);" class="weui-footer__link">底部链接文本</a>
</p>
<p class="weui-footer__text">Copyright © 2008-2019 weui.io</p>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
var $tooltips = $('.js_tooltips');

$('#showTooltips').on('click', function(){
if ($tooltips.css('display') != 'none') return;

// toptips的fixed, 如果有`animation`, `position: fixed`不生效
$('.page.cell').removeClass('slideIn');

$tooltips.css('display', 'block');
setTimeout(function () {
$tooltips.css('display', 'none');
}, 2000);
});
});
</script>

</script>
<script type="text/html" id="tpl_toast">
<div class="page">
Expand Down
103 changes: 102 additions & 1 deletion dist/style/weui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/style/weui.min.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/example/example.less
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ body, .page {
}
}

.page.form{
.weui-label{
width:3em;
}
}
.page.button {
background-color:#EDEDED;
.page__bd {
Expand Down
83 changes: 83 additions & 0 deletions src/example/fragment/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<div class="page">
<div class="weui-form">
<div class="weui-form__text-area">
<h2 class="weui-form__title">表单标题</h2>
<div class="weui-form__desc">表单描述示意</div>
</div>
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">输入框</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">QQ号</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入QQ号"/>
</div>
</div>
</div>
</div>
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">验证码</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入手机号"/>
</div>
</div>
<div class="weui-cell weui-cell_vcode">
<div class="weui-cell__hd"><label class="weui-label">验证码</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="number" pattern="[0-9]*" placeholder=""/>
</div>
<div class="weui-cell__ft">
<button class="weui-btn weui-btn_default weui-vcode-btn">获取验证码</button>
</div>
</div>
</div>
<div class="weui-cells__tips"><a href="javascript:;">收不到验证码</a></div>
</div>
</div>
<div class="weui-form__tips-area">
<label for="weuiAgree" class="weui-agree">
<input id="weuiAgree" type="checkbox" class="weui-agree__checkbox"/>
<span class="weui-agree__text">
阅读并同意<a href="javascript:void(0);">《相关条款》</a>
</span>
</label>
</div>
<div class="weui-form__opr-area">
<a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips">确定</a>
</div>
<div class="weui-form__tips-area">
<p class="weui-form__tips">
点击下一步即表示<a href="javascript:;">同意用户协议</a>
</p>
</div>
<div class="weui-form__extra-area">
<div class="weui-footer">
<p class="weui-footer__links">
<a href="javascript:void(0);" class="weui-footer__link">底部链接文本</a>
</p>
<p class="weui-footer__text">Copyright © 2008-2019 weui.io</p>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
var $tooltips = $('.js_tooltips');

$('#showTooltips').on('click', function(){
if ($tooltips.css('display') != 'none') return;

// toptips的fixed, 如果有`animation`, `position: fixed`不生效
$('.page.cell').removeClass('slideIn');

$tooltips.css('display', 'block');
setTimeout(function () {
$tooltips.css('display', 'none');
}, 2000);
});
});
</script>
6 changes: 6 additions & 0 deletions src/example/fragment/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ <h1 class="page__title">
</div>
<div class="weui-cell__ft"></div>
</a>
<a class="weui-cell weui-cell_access js_item" data-id="form" href="javascript:;">
<div class="weui-cell__bd">
<p>Form</p>
</div>
<div class="weui-cell__ft"></div>
</a>
<a class="weui-cell weui-cell_access js_item" data-id="list" href="javascript:;">
<div class="weui-cell__bd">
<p>List</p>
Expand Down
1 change: 1 addition & 0 deletions src/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<link rel="import" href="./fragment/button.html">
<link rel="import" href="./fragment/list.html">
<link rel="import" href="./fragment/input.html">
<link rel="import" href="./fragment/form.html">
<link rel="import" href="./fragment/toast.html">
<link rel="import" href="./fragment/dialog.html">
<link rel="import" href="./fragment/half-screen-dialog.html">
Expand Down
3 changes: 3 additions & 0 deletions src/style/weui.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
// msg
@import "./widget/weui-page/weui-msg";

// form
@import "./widget/weui-page/weui-form";

// article
@import "./widget/weui-page/weui-article";

Expand Down
68 changes: 68 additions & 0 deletions src/style/widget/weui-cell/weui-cells__group.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Tencent is pleased to support the open source community by making WeUI available.
*
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the MIT License (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

@import "../../base/fn";

.weui-cells__group{}
.weui-cells__group_form{
.weui-cells__title{
margin-top:24px;
margin-bottom:8px;
padding:0 32px;
}
.weui-cells,.weui-cell{
&:before{
left:32px;
right:32px;
}
}
.weui-cells{
&:after{
left:32px;
right:32px;
}
}
.weui-cell{
padding:16px 32px;
}
.weui-cells__tips{
margin-top:8px;
font-weight:700;
padding:0 32px;
color:rgba(0,0,0,.3);
}
.weui-cell_vcode{
padding:12px 32px;
}
.weui-vcode-btn{
font-size:16px;
padding:0 12px;
margin-left:16px;
height:auto;
width:auto;
line-height:2em;
color: #06AE56;
background-color: #F2F2F2;
&:before{
display:none;
}
}
.weui-label{
max-width:5em;
width:auto;
margin-right:24px;
}
}
71 changes: 71 additions & 0 deletions src/style/widget/weui-page/weui-form.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Tencent is pleased to support the open source community by making WeUI available.
*
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the MIT License (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

@import "../../base/fn";
@import "../weui-cell/weui-cells__group";

.weui-form {
padding:56px 0 0;
padding:calc(56px ~"+ constant(safe-area-inset-top)") constant(safe-area-inset-right) constant(safe-area-inset-bottom) constant(safe-area-inset-left);
padding:calc(56px ~"+ env(safe-area-inset-top)") env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
display:flex;
flex-direction:column;
line-height:1.4;
min-height:100%;
box-sizing:border-box;
line-height:1.4;
background-color:#FFFFFF;

a{
&:not(.weui-btn){
color:@weuiLinkColorDefault;
}
}
.weui-footer,.weui-footer__link{
font-size:12px;
}
}
.weui-form__text-area{
color:rgba(0,0,0,.9);
text-align:center;
}
.weui-form__control-area{
flex:1;
margin:48px 0;
}
.weui-form__tips-area,.weui-form__extra-area{
margin-bottom:24px;
text-align:center;
}
.weui-form__opr-area{
margin-bottom:64px;
&:last-child{
margin-bottom:96px;
}
}
.weui-form__title{
font-size:22px;
font-weight:700;
line-height:1.36;
}
.weui-form__desc{
font-size:17px;
margin-top:16px;
}
.weui-form__tips{
color:rgba(0,0,0,.5);
font-size:12px;
}

0 comments on commit 59ac11f

Please sign in to comment.