I am using the template of the sliding menu, but the screen does not pop to Form1.html on the left side.How can I switch?

Asked 1 years ago, Updated 1 years ago, 64 views

<ons-page>
<ons-page style="background-color:#FFF0F5">

<ons-toolbar>
    <div class="right">
    <ons-toolbar-buttoning-click="app.slidingMenu.toggleMenu()">
    <ons-iconion="bars"></ons-icon>            
    </ons-toolbar-button>
    </div>

    <div class="left">
    <ons-toolbar-buttoning-click="Form1.html">
    <ons-icon icon="ion-compose" fixed-width="false"
            style="font-size:26px; vertical-align:-4px"></ons-icon>
    </ons-toolbar-button>
    </div>

    <div class="center"> Word of mouth</div>
</ons-toolbar>

onsen-ui

2022-09-29 22:17

1 Answers

<ons-toolbar-buttoning-click="Form1.html">

There is a problem with ng-click in .
ng-click must write what to do if clicked.
The following example uses ons-navigator to display the Form1.html page using the pushPage method.
<onclick works the same way.

<ons-navigator var="myNavigator">
   <ons-page>
        <ons-toolbar>
            <div class="right">
            <ons-toolbar-buttoning-click="app.slidingMenu.toggleMenu()">
            <ons-iconion="bars"></ons-icon>            
            </ons-toolbar-button>
            </div>

            <div class="left">
            <ons-toolbar-buttoning-click="myNavigator.pushPage('Form1.html')">
            <!--ons-toolbar-button onclick="myNavigator.pushPage('Form1.html')"-->
            <ons-icon icon="ion-compose" fixed-width="false"
                    style="font-size:26px; vertical-align:-4px"></ons-icon>
            </ons-toolbar-button>
            </div>

            <div class="center"> Word of mouth</div>
        </ons-toolbar>
        :
        :
        —Omitted
        :
        :
    </ons-page>
</ons-navigator>

Other than the example above, there are other than the example above.
First, we recommend that you try the sample or read the document.


2022-09-29 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.