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

Reactive values are not updated? why? #260

Open
yuhengliang opened this issue Apr 11, 2024 · 3 comments
Open

Reactive values are not updated? why? #260

yuhengliang opened this issue Apr 11, 2024 · 3 comments
Labels
low priority Done later

Comments

@yuhengliang
Copy link

<div @name="test">
    <p>Countdown: { countdown }</p>
    <script>
        countdown = 0
        mounted() {
            setInterval(() => {
                this.countdown++
                console.log(this.countdown)
            }, 1000)
        }
    </script>
</div>

The ' countdown ' not updated, why ?
How do update automatically?

@yuhengliang
Copy link
Author

can use ' this.update() ' , Are there other ways to update automatically?

@yuhengliang
Copy link
Author

yuhengliang commented Apr 11, 2024

<div @name="test">
    <layout>
        <p>Countdown: { countdown }</p>
    </layout>
    <script>
        countdown = 0
        mounted() {
            setInterval(() => {
                this.countdown++
                console.log(this.countdown)
                this.update()
            }, 1000)
        }
    </script>
</div>

layout is custom component ,

<div @name="layout">
    <slot />
</div>

use this.update(), but, The ' countdown ' not updated to, why ?
How do update automatically?

@fritx
Copy link
Collaborator

fritx commented Apr 17, 2024

I have similar problem with :if:

<label :if="condition"><select @change="render"></select></label>
<script>
render() {
  this.update({ foo: 'bar' })
  // won't work, because inside the `createApp` for `:if`
 // the `Impl` is undefined but not the parent view

  this.foo = 'bar' // works
}
</script>

@tipiirai tipiirai added the low priority Done later label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority Done later
Projects
None yet
Development

No branches or pull requests

3 participants