一. 安装 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。


夏哥
5 声望0 粉丝

同伴与我同在,所以能战斗,所以能坚强,为了所要守护的人,赌上自己的一切!


« 上一篇
vue3 记录