FE-Driver / vue-beauty

Beautiful UI components build with vue and ant design
https://fe-driver.github.io/vue-beauty
MIT License
2.11k stars 248 forks source link

datepicker time 初始化时间展示异常 #316

Open sevenT opened 6 years ago

sevenT commented 6 years ago

版本号: vue-beauty-2.0.0-beta.14, vue-beauty-2.0.0-beta.19 问题描述:

       异步初始化datePicker时, ftime = 2018-08-16 17:35:35 渲染之后ftime变成了 2018-08-16 00:00
       vue-beauty的date-picker组件会默认将日期之后的 小时和分钟变成00:00
       `<v-date-picker v-model="ftime" clearable show-time ></v-date-picker>`

复现代码:

<html>
    <head>
        <link href="vue-beauty.min.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
        <div id="content">
            <v-card title="date-time-picker test">
                <v-date-picker v-model="time" show-time ></v-date-picker>
                <v-input v-model="time" style="margin-top: 15px;width: 150px;" disabled></v-input>
                <v-button @click=changeTime>简单修改time(点两次结果正确)</v-button>  
                <v-button type="primary" @click=changeAndSet>修改并通过nextTick变更</v-button>  
            </v-card>

        </div>
        <script type="text/javascript" src="vue.min.js"></script>
        <script type="text/javascript" src="vue-beauty.js"></script>
        <script type="text/javascript">

            var app = new Vue({
                el: "#content",
                data: {
                    time: ""
                },
                methods: {
                    changeTime: function() {
                        this.time = "2018-07-01 12:13:11";
                    },
                    changeAndSet: function() {
                       this.time = "2018-08-01 14:13:11";
                        var vm = this;
                        this.$nextTick(function(){
                            vm.time =  "2018-08-01 14:13:11";
                        });
                    }
                }
            })
        </script>
    </body>
</html>