简体   繁体   English

在离子幻灯片内部实施社交共享

[英]Implementing social sharing inside ionic slides

I am implementing social sharing in ionic application with this plugin 我正在使用此插件在离子应用程序中实现社交共享

Inside my page i am using ionic slides, 在我的页面内,我正在使用离子幻灯片,

  <ion-slides>
    <ion-slide   *ngFor="let item of strings">
      <div>
        {{ item }}
      </div>
    </ion-slide>
  </ion-slides>

This is my typescript file to get data into slides 这是我的打字稿文件,用于将数据放入幻灯片

export class Birthday {
strings : Array<string>;
  constructor(public navCtrl: NavController, public navParams: NavParams) {
  this.strings = new Array<string>();
    this.strings.push('text1');
    this.strings.push('text2');
    this.strings.push('text3');
    this.strings.push('text4');

  }
}

Now while using social sharing plugin how to get current slide data in message field 现在,在使用社交共享插件时,如何在消息字段中获取当前幻灯片数据

share(**slide data heree**, subject, file, link) {
    this.platform.ready().then(() => {
        if(window.plugins.socialsharing) {
            window.plugins.socialsharing.share(message, subject, file, link);
        }
    });
}

Use viewChild to get the slides in component. 使用viewChild来获取组件中的幻灯片。

import { Slides } from 'ionic-angular';

@ViewChild(Slides)slides:Slides

//To get current slide,
let index = this.slides.getActiveIndex();

//Get the item as:
this.strings[index]

Documentation for slides 幻灯片文档

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

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