2

我正在尝试更改两个按钮的状态。但是,如果我按下一个按钮,两者都会消失。按钮 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>
4

0 回答 0