微信小程序 记录

夏哥 -
微信小程序 记录

一. 安装 npm。
image.png

二. 自定义 底部 tab bar。

小程序 自定义底部 tab bar

三. 短视频模式 video-swiper。

微信小程序 短视频模式 video-swiper

四. 全局分享。

app.js

App({
  onLaunch() {
    this.onShare();
  },
  // 自定义全局分享
  onShare() {
    wx.onAppRoute((res) => {
      //获取当前页面的对象
      let pages = getCurrentPages();
      let view = pages[pages.length - 1];

      if (view) {
        wx.showShareMenu({
          withShareTicket: true,
          menus: ['shareAppMessage', 'shareTimeline']
        });

        let shareOption = JSON.parse(JSON.stringify(view.options));
        let shareOptionStr = '';
        for (let i in shareOption) {
          shareOptionStr += `&${i}=${shareOption[i]}`
        };

        if (!view.onShareAppMessage &&
          Object.prototype.toString.call(view.onShareAppMessage) !== '[object Function]') {
          view.onShareAppMessage = function () {
            return {
              title: 'xxx',
              path: view.route + (!shareOptionStr ? '' : '?' + shareOptionStr)
            }
          };
        };

        if (!view.onShareTimeline &&
          Object.prototype.toString.call(view.onShareTimeline) !== '[object Function]') {
          view.onShareTimeline = function () {
            return {
              title: 'xxx',
              path: view.route + (!shareOptionStr ? '' : '?' + shareOptionStr)
            }
          };
        };
      };
    });
  },
})

Good luck。

特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。
下一篇: leetcode-Day1

Tags 标签

微信小程序

扩展阅读

加个好友,技术交流

1628738909466805.jpg