xianyu-js-sdk.vue 2.06 KB
<!--
 * @description:
 * @fileName: xianyu-js-sdk.vue
 * @author: huzhiming
 * @date: 2019-11-04 18:02:07
 * @后台人员:
 * @version: V1.0.5
 * @path: 页面访问路径及参数说明
!-->
<template>
  <div class="xianyu-js-sdk-wrap">
    <h2>我是一个测试页面</h2>
    <ul>
      <li @click="share()">点击拉出分享弹窗</li>
    </ul>
    {{ searchWord }}
  </div>
</template>

<script>
import { createNamespacedHelpers } from 'vuex'
const { mapState, mapActions } = createNamespacedHelpers('list')
export default {
  // head() {
  //   return {
  //     title: '',
  //     meta: [{ hid: 'keywords', name: 'keywords', content: '' },{ hid: 'hid', name: 'description', content: '' }],
  //     // link: [{ rel: 'stylesheet', href: '' }],
  //     // script: [{ src: '' }]
  //   }
  // },
  asyncData({store, router}) {
    return store.dispatch('list/fetchSearchWords');
  },
  props: {},
  data() {
    return {}
  },
  created() {},
  mounted() {
    // this.fetchSearchWords()
    this.$nextTick(async ()=>{
      await this.$xianyu.setNavigatorRightItem();
    })
  },
  destroyed() {},
  methods: {
    ...mapActions([
      'fetchSearchWords'
    ]),
    share() {
      this.$xianyu.setXianyuShare({
        shareType: 'activity', // 类型,默认activity
        image: 'http://gw.alicdn.com/tps/i1/TB1Nep5FVXXXXXDaXXXE799_VXX-800-800.jpg',
        url: 'http://h5.xianyu.tb.cn/xianyu/maishen.html?wxIsAvailable', // 分享链接
        link: 'http://h5.xianyu.tb.cn/xianyu/maishen.html?wxIsAvailable', // 和url保持
        title: '下载闲鱼App', // 分享标题
        text: '你可记得家里堆积的闲置物,你可知他们正在黯然神伤。让他们来闲鱼卖身吧,即可' // 分享描述
      })
    }
  },
  computed: {
    ...mapState([
      'filterVisible',
      'searchWord'
    ])
  },
  watch: {},
  components: {}
};
</script>

/* 定义局部样式,添加外围容器,scss嵌套尽量不要超过三层,会影响查找器性能 */
<style rel='stylesheet/scss' lang='scss' scoped>
// .xianyu-js-sdk-wrap {}
// @import "./style.scss";
</style>