<template>
<div class="input-number">
<div @click="sub" :class="(islight ? 'light' : '') + ' sub'">-</div>
<div class="num">{{ ipt }}</div>
<div class="add" @click="add">+</div>
</div>
</template> <script>
export default {
name: 'CRInputnumber',
componentName: 'CRInputnumber', data() {
return {
ipt:1,
islight: true,
}
},
created() {
if (this.count > 0) {
this.ipt = this.count
}
this.islight = this.lightFunc()
},
props: {
count:{
type: Number,
default: 1
},
},
methods: {
// 减少数量
sub: function () {
if (this.ipt < 2) {
return
}
this.ipt--
this.islight = this.lightFunc()
},
// 增加数量
add: function () {
this.ipt++
this.islight = this.lightFunc()
},
lightFunc(){
if (this.ipt < 2) {
return true
} else {
return false
}
}
} }
</script> <style lang="LESS" scoped>
@fs12:3.2vw;
@fs14:3.733vw;
@fs15:4vw;
@fs16:4.267vw;
@fs17:4.533vw;
@fs20:5.333vw;
@fs22:5.867vw; @pd1:2.666vw;
@pd2:3.333vw;
@bw:100vw;
@bh:23.333vw;
@iw:16.666vw;
@black:#4c4948;
@gray:#bfc0c0; body,p,h1,h2,h3,h4,h5,h6,img{
padding: 0;
margin:0;
border:0;
}
div,span,p{
font-size: @fs12;
}
.input-number{
color: @black;
font-size: @fs20; min-width: 4.5625rem;
height: 1.375rem;
box-sizing: border-box;
border: 1px solid #e5e5e5;
position: relative;
margin-top: -0.6875rem;
top:50%;
display: flex;
justify-content: space-between;
.sub,.add,.num{
height: 100%;
line-height: 1.25rem;
text-align: center;
}
.sub,.add{
width: 1.375rem;
transform: scale(1.5,1.5) translateY(-0.3vw);
}
.num{
border-left:1px solid #e5e5e5;
border-right:1px solid #e5e5e5;
padding: 0 0.6rem;
font-weight: 700;
} .light{
color: #e5e5e5;
}
} </style>

最新文章

  1. sql server 跨数据库插入数据
  2. oracle case when 在查询时候的用法。
  3. mysql管理(一)
  4. 点击页面div弹窗以外隐藏的两种思路
  5. 移动端单页视图库,适用于制作移动Web touchbox
  6. Logstash type来标记事件类型,通过type判断
  7. RESTful最佳实践之基于 jersey 的增删改查
  8. WPF六个控制概述
  9. ReentrantLock深入学习
  10. 【翻译】.Net Core的意义
  11. ##1.Centos7环境准备-- openstack pike
  12. [知了堂学习笔记]_牵线Eclipse和Tomcat第二篇 —— 安装Tomcat&amp;&amp;添加Tomcat到Eclipse
  13. zeromq的安装,部署(号称最快的消息队列,消息中间件)
  14. linux下read命令详解
  15. 同步或者重构Activiti Identify用户数据的多种方案比较
  16. PHP之流程控制
  17. Windows 环境变量立即生效
  18. hdu1281 棋盘游戏 二分图最大匹配
  19. python(十二)下:ORM框架SQLAlchemy使用学习
  20. excel自定义函数添加和使用方法

热门文章

  1. 01 . ELK Stack简介原理及部署应用
  2. READSJC.md
  3. Day10-微信小程序实战-交友小程序-创建friendList字段实现好友关系(添加好友功能)--内附代码
  4. JDK8--01:JDK8简介
  5. 线程的创建方式以及synchronize的使用
  6. python数据结构(三)
  7. Selenium WebDriver使用
  8. 深入了解JVM-方法区
  9. 一次运维-堡垒机多次跳转导出及导入mysql数据库
  10. 蓝桥杯javaB组入坑