-
Notifications
You must be signed in to change notification settings - Fork 6
Guyuan #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Guyuan #1
Conversation
hunshcn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
写的不错,代码质量挺高,样式有比较大的提升空间
| this.result=this.result*num | ||
| }else if(fun=="/"){ | ||
| this.result=this.result/num | ||
| }else if(fun=="%"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%的逻辑与其他不一致,需要单独拎出来。两次的原因是当你第一次点击%的时候,你的fun是上上次操作,而不是%。要在这超长的if前对targetvalue进行判断。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯嗯我改好了
| <view hover-class="bg" hover-start-time="50" hover-stay-time="100" bindtap="potButton">.</view> | ||
| <view hover-class="bg" hover-start-time="50" hover-stay-time="100" bindtap="funButton"data-value="=">=</view> | ||
| </view> | ||
| </view> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
复用函数的思想很不错,节省了很多代码,像这种全都是.bg的,你可以在父元素加class,用.bg view的选择器来选择,省的写那么多class
| <view id="totality"> | ||
| <view id="result"> | ||
| <view id="num">{{num}}</view> | ||
| <view id="fun">{{fun}}</view> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果不需要显示直接不写这行就行了....
其实运算符可以在左边显示出来,也比较易用
隐藏比如display:none; height:0; width:0; font-size:0; color:transparent; visiablity:hidden都可以
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来可以不写……受教了
| .bg{ /*hover-class的颜色*/ | ||
| background: rgb(179, 177, 177); | ||
| } | ||
|
No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
样式......还行但不是特别好看,简单来讲可以缩小字体宽松布局
然后还可以看情况加上按钮背景颜色和边框
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy that~小米的计算器没加按钮颜色和边框(理直气壮
| position: relative; | ||
| } | ||
|
|
||
| #num{ /*结果*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
结果有一个bug,比如1/3这种无限小数,由于没做位数限制,会把屏幕占满,0.333333333只会显示出来33333,
可以在结果那边加上一个简单判断
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
| <view> | ||
| <view hover-class="bg" hover-start-time="50" hover-stay-time="100" bindtap="resetButton">AC</view> | ||
| <view hover-class="bg" hover-start-time="50" hover-stay-time="100" bindtap="DELButton">DEL</view> | ||
| <view hover-class="bg" hover-start-time="50" hover-stay-time="100" bindtap="funButton" data-value="%">%</view> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace "funButton" with"perButton"
1