1.WXML
<view class="container">
<view><button class='question' open-type='share'>转发</button></view>
</view>
2.WXSS
.question{
width: 80%;
height: 50px;
position: fixed;
top: 5%;
left: 10%;
line-height: 50px;
color: #fff;
font-size: 30px;
background-color: #34e3f3;
border: 1px solid #eee;
text-align: center;
}
3.JS
const app = getApp()
Page({
//转发
onShareAppMessage: function(res){
if(res.from === 'button'){
console.log(res.target)
}else if(res.from === "menu"){
console.log(res)
}
return {
title: '转发关注小可爱',
path: '/pages/logs/logs'
}
}
})
4.效果展示
转发按钮效果.png menu菜单转发.png
网友评论