gpt4 book ai didi

polymer-2.x - Polymer 就绪与 connectedCallback

转载 作者:行者123 更新时间:2023-12-04 17:47:59 42 4
gpt4 key购买 nike

我想知道 ready() 方法在 polymer 中的重要性是什么,这种方法的准时初始化是什么意思,以及 read( )connectedCallback() ???

最佳答案

以下应该有所帮助。

connectedCallback can be called more than once

...

Generally all setup work in connectedCallback should be balanced with associated teardown work in disconnectedCallback; if not it usually means connectedCallback is the wrong place to do it

...

At this point it's hard to contrive general a use case where ready is the only/best place to do work, although they do come up from time to time in very specific cases.

...

ready is called only once, so work done here based on a property value may become invalidated if the property value is changed at a later point by the user

参见 https://github.com/Polymer/polymer/issues/4108#issuecomment-258983943

关于polymer-2.x - Polymer 就绪与 connectedCallback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47474265/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com