简体   繁体   English

Riot Js正在更新标签

[英]Riot Js Updating tag

If i'm on the form tag and I want to update the nav tag. 如果我在表单标签上,我想更新导航标签。 When a event happens on the form tag. 当事件发生在表单标记上时。 How can I update the nav without riot.update(); 如何在没有riot.update()的情况下更新nav;

  <form id="signup" class="row" action="" method="">
       <ul class="small-10 small-centered columns">
          <li>
            <div class="error" if={this.email.error}>Required</div>
            <input onfocus="{focus}" onblur="{blur}" type="text" name="email" value="" placeholder="Email Address">
         </li>
      </ul>
    </form>

</script>

    this.focus = function() {
        this.session.focused = true;
        riot.update();
    };

    this.blur = function() {
       this.session.focused = false;
       riot.update();
    };

</script>

different page 不同的页面

  <nav class="{show: this.open === true, fix-header: this.session.focused}">

    </nav>

Use something like redux to store global app state. 使用像redux这样的东西来存储全局应用程序状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM