Write the code in the js file
/**
* 设置分享的名称和logo
*/
onShareAppMessage() {
return {
title: 'WebJob',
imageUrl: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big84000.jpg',
path: '/pages/index/index'
}
},
There are two places on the page that can trigger forwarding events:
One is the forward button in the upper right menu
The other is a button with an attribute open-type and a value of share in the page. (Note: it must be a button component, setting open-type="share" in other components is invalid)
即:<button data-name="shareBtn" open-type="share">转发</button>
Note: In actual development, you will find that this button has its own style. When the background color is set to white, there is a black border. At first, the border can't be removed. Later, a style attribute plain=" is added to the button. After true", control the style button[plain]{ border:0} in the style file, and you can customize the style more casually, such as making the share button an icon, etc.
Send a wave of benefits