ElemeFE / mint-ui

Mobile UI elements for Vue.js
http://mint-ui.github.io/#!/en
MIT License
16.56k stars 3.55k forks source link

使用datepicker时出现的问题,无法打开,控制台报错 #786

Closed nk097 closed 7 years ago

nk097 commented 7 years ago

使用datepicker时出现的问题,无法打开,控制台报错 # Mint UI version

2.2.1

OS/Browsers version

chrome

Vue version

2.0

[Vue warn]: Error in callback for watcher "rims": (found in ) warn @ vue.esm.js?65d7:564 handleError @ vue.esm.js?65d7:1445 run @ vue.esm.js?65d7:2500 flushSchedulerQueue @ vue.esm.js?65d7:2278 (anonymous) @ vue.esm.js?65d7:459 nextTickHandler @ vue.esm.js?65d7:408 vue.esm.js?65d7:1449 TypeError: value.getFullYear is not a function at VueComponent.getYear (eval at (app.js:797), :1934:89) at VueComponent.boundFn [as getYear] (eval at (app.js:735), :125:14) at VueComponent.handleExceededValue (eval at (app.js:797), :1872:51) at VueComponent.boundFn [as handleExceededValue] (eval at (app.js:735), :126:12) at VueComponent.generateSlots (eval at (app.js:797), :1857:12) at VueComponent.boundFn [as generateSlots] (eval at (app.js:735), :126:12) at VueComponent.rims$1 (eval at (app.js:797), :2011:12) at Watcher.run (eval at (app.js:735), :2498:19) at flushSchedulerQueue (eval at (app.js:735), :2278:13) at Array.eval (eval at (app.js:735), :459:20)

代码: 按需在.vue模板中使用 import { MessageBox, Toast, DatetimePicker } from 'mint-ui' 注:MessageBox, Toast 均可正常使用

<mt-datetime-picker v-model="pickerVisible" type="date"> 最基本的复制模板

在一个元素中设置了开关:点击开关就报错了 <span @click="openDatePicker">

虚心求解答~~!!!

galenyuan commented 7 years ago

代码贴一下,好像是值传的有问题

nk097 commented 7 years ago

按需引入: import { MessageBox, Toast, DatetimePicker } from 'mint-ui'

html部分:(还没有设置任何,直接从文档上复制下来)

<mt-datetime-picker v-model="pickerVisible" type="date"> </mt-datetime-picker>

函数: 开关触发:

openDatePicker() {
        this.pickerVisible = !this.pickerVisible
      },

点击改元素触发开关: <span @click="openDatePicker"></span>

代码就这么多,没有了。还需要其他的吗?

galenyuan commented 7 years ago

mt-datetime-picker 的 v-model 传的是什么?

galenyuan commented 7 years ago

image 好好读文档...

nk097 commented 7 years ago

pickerVisible,我把他设成了显示的开关的一个参数了,不过现在改过来了。 v-model="this.babyInfo.Birthday" this.babyInfo.Birthday这个的值是后台传过来的 "Birthday": "/Date(-28800000+0800)/",
是这个一个格式 现在改了过来可以成功打开了! 感谢提醒~因为pickerVisible有点被误导了哈哈哈~