sysShare

首次使用请执行weexplus plugin add https://github.com/farwolf2010/sysShare

调用系统分享功能,可以分享到微信,优点是不用去微信审核

api

  1. /**
  2. ** param: {type:('txt','image'),content:'连接地址或图片路径'}
  3. **/
  4. share(param)

demo

  1. <template>
  2. <div ref="root" style="align-items: center;justify-content: center">
  3. <button ref="btn" text="分享链接" @click="shareText"></button>
  4. <button ref="btn" text="分享图片" @click="shareImage"></button>
  5. </div>
  6. </template>
  7. <script>
  8. export default{
  9. data(){
  10. return {}
  11. },
  12. props: {},
  13. methods: {
  14. shareText(){
  15. let sys=weex.requireModule('sysShare')
  16. // sys.share({type:'image',image:'http://www.pc-fly.com/uploads/allimg/160416/1U05E217_1.jpg'})
  17. sys.share({type:'txt',content:'http://share.atoxchain.io/#/h5/invite.js/thomasxing'})
  18. },
  19. shareImage(){
  20. const photo = weex.requireModule('photo');
  21. photo.openPhoto(500,800,'#000000','#ffffff','#ffffff',(e)=>{
  22. let sys=weex.requireModule('sysShare')
  23. sys.share({type:'image',image:e.path})
  24. });
  25. // let sys=weex.requireModule('sysShare')
  26. // sys.share({type:'image',image:'http://www.pc-fly.com/uploads/allimg/160416/1U05E217_1.jpg'})
  27. // sys.share({type:'txt',content:'http://share.atoxchain.io/#/h5/invite.js/thomasxing'})
  28. },
  29. onLoad(p){
  30. }
  31. },
  32. created(){
  33. }
  34. }
  35. </script>
  36. <style scoped>
  37. </style>