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

修改了数据,发现修改数据不好用,改成{id: 1111,date:'2019-12-01',status: 2,},还是现实在当前年份,当前月份,没有改变,数据 展示不对。 #1

Open
hangaojie opened this issue May 25, 2018 · 6 comments

Comments

@hangaojie
Copy link

No description provided.

@yscoder
Copy link
Owner

yscoder commented May 25, 2018

修改数组的某一项,要么使用全新数组,要么使用 vue.$setarray.splice 对某一项进行修改。
参考:changeDate

@hangaojie
Copy link
Author

hangaojie commented May 31, 2018

感谢您的回复。辛苦了。^_^
我没有表达清楚我的意思,我遇到的问题是:项目启动时的默认数据,我修改了。效果:在页面显示的时间和默认数据的时间不对应。我没有等项目启动之后,再去操作更新数组。

@yscoder
Copy link
Owner

yscoder commented May 31, 2018

你说的应该是默认显示时间的问题,目前是当前月,还没有提供相关设置

@hangaojie
Copy link
Author

hangaojie commented Jun 1, 2018

感谢您的再次回复 !
代码里写的是“2016-06-01”,是2016年,页面却显示在当前年份(2018)年。
details

@IT-Rafi
Copy link

IT-Rafi commented Jul 24, 2018

您好,我想问下怎么可以限制时间范围呢

@dearmsdan
Copy link

感谢您的再次回复 ! 代码里写的是“2016-06-01”,是2016年,页面却显示在当前年份(2018)年。 details

需要自己修改代码,在vue初始化时候改成

created() {
    // 显示为当月的数据
    const now = new Date()
    this.events = this.events.map(item => {
        // console.log(item.date);
        const d = item.date.split('-')[2]
        const m = item.date.split('-')[1]
        const y = item.date.split('-')[0]
        //console.log(y);
        
        item.date = `${y}-${m}-${d}`
        
        console.log(item.date);
        return item
    })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants