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

页面销毁后,data数据并未重置(二级数据) #413

Closed
Lingouzi opened this issue Jul 17, 2019 · 8 comments
Closed

页面销毁后,data数据并未重置(二级数据) #413

Lingouzi opened this issue Jul 17, 2019 · 8 comments

Comments

@Lingouzi
Copy link

@dntzhang

<button bind:tap="gotoTest">测试</button>
gotoTest() {
        wx.navigateTo({
            url: '/pages/test?text=1',
        })
    },

然后test页面:

create.Page({
    context: { emitter: create.emitter },
    data: {
        logs: {
            motto: '',
            msg: [],
        },
    },
    onLoad(e) {
        console.log('test 页面 onload', e, '同时获取motto值:', this.oData.logs)
        this.oData.e = e
    },
    onUnload() {
        console.log('test 页面 onUnload..此时应该销毁该页面data中所有值')
    },
    handleInput(e) {
        this.oData.logs.motto = e.detail.value
        console.log('监控到输入:', this.oData.logs.motto)
    },
})

重点是:motto属性是在logs下,输入一个值,赋予motto,然后左上角返回,再次进入就可以看到效果了。

  • data一级属性没毛病
@dntzhang
Copy link
Collaborator

依然不复现啊

@dntzhang
Copy link
Collaborator

D032B5ED-67BC-4B5E-AEA6-B4130F39338F

@Lingouzi
Copy link
Author

Lingouzi commented Jul 17, 2019 via email

@dntzhang
Copy link
Collaborator

没有附件啊

@Lingouzi
Copy link
Author

Lingouzi commented Jul 17, 2019 via email

@dntzhang
Copy link
Collaborator

?

@Lingouzi
Copy link
Author

Lingouzi commented Jul 17, 2019 via email

@dntzhang
Copy link
Collaborator

你试试就知道了,数据会重新初始化的。

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

2 participants