tbom
Version:
Taobao Open Platform Modules
80 lines (65 loc) • 1.66 kB
JavaScript
import {createElement, Component} from 'rax';
import View from 'tboc-view';
import Text from 'tboc-text';
import styles from '../common/style.css';
import { share } from '../../../src/index';
const img = '//gw.alicdn.com/tfscom/TB2u9kWppXXXXahXpXXXXXXXXXX_!!0-dgshop.jpg';
function openShare() {
share({
appkey: '23025092',
// bussine ID,for data statistics
businessId: '33',
// share title
title: '分享内容的标题',
// share desc
text: '要分享的内容',
// share icon
image: img,
// share URL
url: '//m.taobao.com',
// share menu target list
targets: 'all'
}, function(e) {
console.log(e);
// success: do something
}, function(e) {
console.log(e);
// fail: do something
});
// {
// title:"分享的标题", // 分享标题 在来往和微信好友中有标题显示
// content: "分享内容", //分享的内容
// url: "", // 跳转地址,分享的内容跳转的url
// image:""
// }
}
class ShareDemo extends Component {
render() {
return (
<View style={styles.app}>
<View clickable={true}onPress={openShare} onClick={openShare} style={demoStyles.button}>唤起分享(不支持 Web)</View>
</View>
);
}
}
const demoStyles = {
input: {
borderWidth: 2,
borderColor: '#CCC',
borderStyle: 'solid'
},
text: {
paddingLeft: 20,
paddingRight: 20
},
button: {
borderWidth: 2,
borderColor: '#CCC',
borderStyle: 'solid',
paddingLeft: 20,
paddingRight: 20,
marginTop: 40,
backgroundColor: '#EEE'
}
}
export default ShareDemo;