我如何在Ionic 4中触发slideNext

时间:2019-05-02 12:01:18

标签: ionic-framework ionic4

我正在使用Ionic 4,我想在自定义函数中触发slideNext(),但我不知道如何调用slideNext()。谁能帮我。这是我的html代码。

        webView.setWebChromeClient(new WebChromeClient(){
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            mProgressBar.setProgress(newProgress);
        }

        webView.setWebViewClient(new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String request)
        {
            webView.loadUrl(request);
            return true;
        }
        public void onPageFinished(WebView view, String url) {
            mProgressBar.setVisibility(View.GONE);
            super.onPageFinished(view, url);
        }

1 个答案:

答案 0 :(得分:0)

这里是一个使用方法的示例

.html

  <ion-slides pager="true" #theSlides>
<ion-slide class="step-one" (click)="move(theSlides)">
    <ion-img src="/assets/icon/favicon.png"></ion-img>
    <h1>Heading 1</h1 >
    <p>Text</p>
</ion-slide>

<ion-slide class="step-two" >
    <ion-img src="/assets/icon/favicon.png"></ion-img>
    <h1>Heading 2</h1>
    <p>Text</p>
</ion-slide>

<ion-slide class="step-three" >
    <ion-img src="/assets/icon/favicon.png"></ion-img>
    <h1>Heading 3</h1>
    <p>Text</p>

    <ion-button (click)="finish()">FINISH TUTORIAL!</ion-button>
</ion-slide>

.ts

move(slides){
    console.log(slides)
    slides.slideTo(2)
}

在自定义功能(#theSlides)中将引用(move(theSlides))传递给幻灯片