webview.vue 836 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view>
  3. <web-view v-if="pagesrc!=null" :src="pagesrc"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. var _this;
  8. export default {
  9. data() {
  10. return {
  11. pagesrc: null
  12. }
  13. },
  14. onLoad: function(option) {
  15. _this = this;
  16. var pagesrc = option.pagesrc || null;
  17. if (pagesrc == null) {
  18. uni.showModal({
  19. title: '温馨提示',
  20. content: "网页链接不存在。",
  21. showCancel: false,
  22. success: function(res) {
  23. if (res.confirm) {
  24. uni.navigateBack({
  25. delta: 1
  26. });
  27. }
  28. }
  29. });
  30. } else {
  31. _this.pagesrc = decodeURIComponent(pagesrc);
  32. }
  33. },
  34. onShareAppMessage: function(res) {
  35. return {
  36. title: "一起运动",
  37. path: "/pages/tool/webview?pagesrc=" + encodeURIComponent(_this.pagesrc)
  38. }
  39. },
  40. methods: {}
  41. }
  42. </script>
  43. <style>
  44. </style>