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

camera 元素 onLoad (onShow) 隐藏还会展示出来 #9

Open
longyiyiyu opened this issue Feb 28, 2019 · 1 comment
Open

camera 元素 onLoad (onShow) 隐藏还会展示出来 #9

longyiyiyu opened this issue Feb 28, 2019 · 1 comment
Labels
camera about camera experience learn from this

Comments

@longyiyiyu
Copy link
Contributor

<camera wx:if="showCamera" ></camera>
Page({
    data: {
        showCamera: true
    },
    onLoad: {
        this.setData({ showCamera: false });
    }
})

camera 还是会展示出来,就只有相机展示(如果 <camera> 元素里面还有其他元素的话,这些元素不会展示)

@longyiyiyu longyiyiyu added experience learn from this camera about camera labels Feb 28, 2019
@longyiyiyu
Copy link
Contributor Author

猜测,如果页面有系统资源,会提前加载。按理说首次渲染的 dataonShow 之后的,但是这里唯独相机出来了,所以应该是系统资源做了特殊的处理导致的。

这里的解决方案就是反过来用就好了。data 不要设置为 true,在 onLoad 里面判断真的要展示的时候才设置为 true

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

No branches or pull requests

1 participant