這次帶給大家使用mint-ui時間外掛時怎麼取得選擇值,使用mint-ui時間外掛程式取得選擇值的注意事項有哪些,下面就是實戰案例,一起來看一下。
{{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()+'日
我相信看了本文案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章!
推薦閱讀:
以上是使用mint-ui時間插件時怎麼取得選擇值的詳細內容。更多資訊請關注PHP中文網其他相關文章!