Commit cf2a3e20 authored by jiangjiantao's avatar jiangjiantao

键盘内容超出优化

parent 3cf5c999
......@@ -62,7 +62,7 @@
/* icon+结果 */
.result-container {
width: 80%;
width: 85%;
height: 60rpx;
display: flex;
flex-direction: row;
......@@ -79,7 +79,7 @@
/* 结果展示 */
.result-display {
width: 80%;
width: 85%;
height: 100%;
display: flex;
align-items: center;
......@@ -108,7 +108,7 @@
/* 中间空白的部分 */
.result-blank {
width: 10%;
width: 5%;
height: 100%;
}
......
......@@ -10,7 +10,7 @@
<text class="result-display-text-empty" a:if="{{result == '' && scenes == 2}}">请输入会员号</text>
<text class="result-display-text-empty" a:if="{{result == '' && scenes == 3 }}">请输入收款金额</text>
<text class="result-display-text-empty" a:if="{{result == '' && scenes == 4}}">请输入退款金额</text>
<text class="result-display-text" a:if="{{result != ''}}">{{result}}</text>
<text class="result-display-text" a:if="{{result != ''}}">{{showresult}}</text>
</view>
</view>
<view class="result-baseline">
......
Component({
mixins: [],
data: {
showresult:"",
result: "",
scenes: 2,
errMsg: ""
......@@ -23,6 +24,7 @@ Component({
this.setData({
result: '',
errMsg: '',
showresult:''
});
}
......@@ -35,36 +37,41 @@ Component({
add7(e) {
this.setData({ result: this.data.result + "7" });
this.addInputContont("7")
}, add8(e) {
this.setData({ result: this.data.result + "8" });
this.addInputContont("8")
}, add9(e) {
this.setData({ result: this.data.result + "9" });
this.addInputContont("9")
}, add4(e) {
this.setData({ result: this.data.result + "4" });
this.addInputContont("4")
}, add5(e) {
this.setData({ result: this.data.result + "5" });
this.addInputContont("5")
}, add6(e) {
this.setData({ result: this.data.result + "6" });
this.addInputContont("6")
}, add1(e) {
this.setData({ result: this.data.result + "1" });
this.addInputContont("1")
}, add2(e) {
this.setData({ result: this.data.result + "2" });
this.addInputContont("2")
}, add3(e) {
this.setData({ result: this.data.result + "3" });
this.addInputContont("3")
}, add0(e) {
this.setData({ result: this.data.result + "0" });
this.addInputContont("0")
}, addpoint(e) {
if (this.data.scenes == 3 || this.data.scenes == 4) {
this.setData({ result: this.data.result + "." });
this.addInputContont(".")
}
}, delete(e) {
if (this.data.result.length > 1) {
let cur = this.data.result;
cur = cur.substring(0, cur.length - 1)
this.setData({ result: cur });
let shownewresult = cur
if (cur.length > 13) {
shownewresult = "..." + cur.substring(cur.length - 11, cur.length)
}
this.setData({ result: cur, showresult: shownewresult });
} else {
this.setData({ result: '' });
this.setData({ result: '',showresult:''});
}
}, finish(e) {
this.setData({ errMsg: "" })
......@@ -85,8 +92,19 @@ Component({
this.props.onKeyBordFinished(this.data.result);
}, closeKeybord(e) {
this.props.onKeyBordClose();
}
},
//处理输入的内容
addInputContont(content){
let newresult = this.data.result + content;
let shownewresult = newresult
if(newresult.length > 13){
shownewresult = "..."+ newresult.substring(newresult.length - 11,newresult.length)
}
this.setData({ result: newresult,showresult:shownewresult});
}
},
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment