AMP - 显示/隐藏多个按钮

时间:2018-05-22 08:21:51

标签: amp-html amp-bind

我试图改变两个按钮的状态。 但是如果我按下一个按钮就会消失。 按钮1应切换到按钮2(反之亦然) 和 按钮3到按钮4(反之亦然) 但如果按一个按钮,另一个消失

    <section>
        <button 
        class="button1 show" 
        [class]="button1 ? 'button1 show' : 'button1 hide'" 
        on="tap:AMP.setState({button1: visible, button2: !visible})">
        <span class="">Button 1</span>
        </button>

        <button 
        class="button2 hide" 
        [class]="button2 ? 'button2 show' : 'button2 hide'" 
        on="tap:AMP.setState({button1: !visible , button2: visible})">
        <span class="">Button 2</span>
        </button>
</section>



<section>
        <button 
        class="button3 show2" 
        [class]="button3 ? 'button3 show2' : 'button3 hide2'" 
        on="tap:AMP.setState({button3: visible, button4: !visible})">
        <span class="">Button 3</span>
        </button>

        <button 
        class="button4 hide2" 
        [class]="button4 ? 'button4 show2' : 'button4 hide2'" 
        on="tap:AMP.setState({button3: !visible , button4: visible})">
        <span class="">Button 4</span>
        </button>
</section>

0 个答案:

没有答案