Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] DatetimeView组件触发render方法时报错 #2797

Closed
luhnnx opened this Issue May 24, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@luhnnx
Copy link

luhnnx commented May 24, 2018

VUX version

2.7.7

OS/Browsers version

win/chrome

Vue version

2.5.13

Code

<template>
  <div>
    <datetime-view ref="datetime" v-model="time" :format='format'></datetime-view>
    <button style="width:200px;height:100px;font-size:20px" @click="clickButton">test</button>
  </div>
</template>
<script>
  import {  DatetimeView } from 'vux'
  export default {
    data() {
      return {
          time: '2017-10-17',
          format: 'YYYY-MM-DD'
      }
    },
    methods: {
        clickButton(){
            this.time = '2019-10-23 10'
            this.format = 'YYYY-MM-DD HH'
            this.$refs.datetime.render()
        }
    },
    components: {
      DatetimeView
    }
  }

</script>
<style>
</style>

Steps to reproduce

1.页面开始时DatetimeView组件定位到设置的时间2017-10-17
2.点击按钮test
3.控制台报错且DatetimeView组件没有定位到设置时间2019-10-23 10
报错信息:
Uncaught TypeError: Cannot read property 'style' of null
at eval (datetimepicker.js?cd5e:185)

What is Expected?

点击按钮test后控制台不报错,且DatetimeView组件能够定位到设置的时间处

What is actually happening?

DatetimeView组件没有能够定位到设置的时间处,且控制台报错。
报错信息:
Uncaught TypeError: Cannot read property 'style' of null
at eval (datetimepicker.js?cd5e:185)

unclay added a commit that referenced this issue May 26, 2018

@unclay

This comment has been minimized.

Copy link
Collaborator

unclay commented May 26, 2018

已修复,下版本更新
format是响应属性,可以先设置,在设置value

this.format = 'YYYY-MM-DD HH'
this.$nextTick(() => {
  this.value1 = '2019-10-23 10'
  this.$refs.datetime.render()
})

@unclay unclay closed this May 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.