随便总结下
------------------------这是分割线---------------------------
时间之前不可选择
<el-date-picker
v-model="value"
type="date"
:editable="false"
placeholder="日期筛选"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions0">
</el-date-picker>
export default{
data(){
return{
value:'',
// 禁止选择当前日期之前的日期
pickerOptions0: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7;
}
}
}
}
}
保留两位小数
<el-input @keyup.native="proving(index)" v-model="item.Price"></el-input>
// 只能输入数字且只有一位小数
proving() {
// this.form.skus[e].Price 是input的值
// 先把非数字的都替换掉,除了数字和.
this.form.skus[e].Price = this.form.skus[e].Price.replace(/[^\d.]/g, '');
// 必须保证第一个为数字而不是.
this.form.skus[e].Price = this.form.skus[e]Price.replace(/^\./g, '');
// 保证只有出现一个.而没有多个.
this.form.skus[e].Price = this.form.skus[e].Price.replace(/\.{2,}/g, '');
// 保证.只出现一次,而不能出现两次以上
this.form.skus[e].Price = this.form.skus[e].Price.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');
let index = -1
for (let i in this.form.skus[e].Price) {
if (this.form.skus[e].Price[i] === '.') {
index = i
}
if (index !== -1) {
if (i - index > 1) {
this.form.skus[e].Price = this.form.skus[e].Price.substring(0, this.form.skus[e].Price.length - 1)
}
}
}
},
解决input number类型上下滚动 禁用滚轮事件
<el-input type="number" @mousewheel.native.prevent />
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button{
-webkit-appearance: none !important;
margin: 0;
}
input[type="number"]{-moz-appearance:textfield;}
elementUI + vue 输入框只能输入正整数 不能输入字母 e 以及+ - 号`
<el-input :inline="true" v-model="dialogForm.closeTime" onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" type="number"></el-input>
箭头变手指css代码
cursor: pointer;
VUE_JS模板
export default {
data() {
return {
}
},
methods: {
}
}
放一波福利
https://jx.618g.com/?url=
任何会员电影电视剧复制地址粘贴这个url后面就可以免费看了