一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

mint-ui 时间插件使用及获取选择值的方法

时间:2018-02-17 编辑:猪哥 来源:一聚教程网

{{pickerValue}}
data () { return { pickerValue:null, 定义 methods:{ openPicker() { this.$refs.picker.open();设置开始 }, handleConfirm(){ console.log(this.pickerValue) ;获取值}, 转换小时 formatDate(date) { const y = date.getFullYear() let m = date.getMonth() + 1 m = m < 10 ? '0' + m : m let d = date.getDate() d = d < 10 ? ('0' + d) : d return y + ' ' + m + ' ' + d }, handleConfirm(){ let a = this.pickerValue // console.log(a.split(" ")) ; this.zheng=this.formatDate(this.$refs.picker.value) console.log(this.formatDate(this.$refs.picker.value)) // console.log(this.value) ; }, 设置当前日期为初始日期 data(){ return{ startDate: new Date(), } } 设置默认值 this.zheng=new Date().getFullYear()+'年'+new Date().getMonth()+1+'月'+new Date().getDate()+'日

热门栏目