微信小程序之——自定义分享按钮(完整版)

1.声明 onShareAppMessage 函数

  onShareAppMessage() {

         return {

       title: '弹出分享时显示的分享标题'

        desc: '分享页面的内容',

        path: '/page/user?id=123' // 路径,传递参数到指定页面。

    }

      },

 

2.自定义按钮是需要在button标签上写上 open-type='share’属性,在dom中写入button组件

<button open-type='share'>分享</button>

 

3.一般自定义按钮和button组件的样式会有冲突, 下面代码就是更改button组件的样式的:
button::after {

  border: none;

      }

扫描二维码关注公众号,回复: 4642857 查看本文章

      button {

  background-color: #fff;

     }

去掉边框和背景色,就ok了。

以上就是一套完整的微信小程序之——自定义分享按钮;如果客官觉得帮到你了,就点个赞呗!

猜你喜欢

转载自blog.csdn.net/Allan_L/article/details/82256843
今日推荐