错误提示
scroller.js?fa07:226 Uncaught TypeError: Cannot read property 'classList' of undefined
代码
main.js
import { ToastPlugin, dateFormat, LoadingPlugin, DatetimePlugin } from 'vux'
Vue.use(ToastPlugin)
Vue.use(LoadingPlugin)
Vue.use(DatetimePlugin)
index.vue
<li @click="chooseStartTime">
<div>
<p>开始时间1:</p>
<p>{{time1}}</p>
</div>
</li>
chooseStartTime () {
let that = this
that.$vux.datetime.show({
cancelText: '取消',
confirmText: '确定',
format: 'YYYY-MM-DD HH',
value: '2017-05-20 18',
onConfirm (val) {
console.log('plugin confirm', val)
},
onShow () {
console.log('plugin show')
},
onHide () {
console.log('plugin hide')
}
})
}
我也是一样的问题 请问你解决了吗
Uncaught TypeError: Cannot read property 'classList' of undefined
at Scroller.__selectItem (scroller.js?bf61:226)
at Scroller.__scrollingComplete (scroller.js?bf61:240)
at Scroller.scrollTo (scroller.js?bf61:208)
at Scroller.selectByIndex (scroller.js?bf61:170)
at Scroller.select (scroller.js?bf61:181)
at new Scroller (scroller.js?bf61:94)
at renderScroller (datetimepicker.js?2116:82)
at Array.eval (datetimepicker.js?2116:241)
at each (util.js?4266:6)
at DatetimePicker.show (datetimepicker.js?2116:226)
先试试直接引入组件 import { Datetime } from 'vux' 但是不需要使用,看能不能解决。
@airyland 尝试过不生效, 不过刚刚按照以下方法解决了,感谢.
更新vux到最新的版本(2.7.7)
找到src/plugins/datetime/index.js
加入require('../../components/datetime/style.less')
运行 问题解决了
@airyland 我试了你的方法可以,但是需要在页面是页面上使用一次组件,我的代码如下
<!--引入一次datetime,一遍防止直接调用时间插件出现bug start -->
<datetime style="display: none"></datetime>
<!--引入一次datetime,一遍防止直接调用时间插件出现bug end -->
。。。
import {Datetime} from 'vux'
components: {Datetime},
@315024900 老铁 我只能双击 6666了 太他妈的 机智了~~
在下个小版本 v2.8.1 解决样式注入问题。
Most helpful comment
@airyland 尝试过不生效, 不过刚刚按照以下方法解决了,感谢.
更新vux到最新的版本(2.7.7)
找到src/plugins/datetime/index.js
加入require('../../components/datetime/style.less')
运行 问题解决了