index.vue 1014 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view>
  3. <web-view v-if="webSrc" :src="webSrc" @message="onPostMessage" />
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. webSrc: "",
  11. };
  12. },
  13. onLoad(options) {
  14. /* encodeURIComponent(``) */
  15. if (options.parems)
  16. this.webSrc = `http://61.164.207.46:8200/webviewtools/index.html#/pages/photoGallery/index?parems=${
  17. options.parems
  18. }&title=${options.title || "电子相册"}`;
  19. if (options.title) {
  20. uni.setNavigationBarTitle({
  21. title: options.title,
  22. });
  23. setTimeout(() => {
  24. uni.setNavigationBarTitle({
  25. title: options.title,
  26. });
  27. }, 500);
  28. }
  29. },
  30. onUnload() {
  31. this.$Http.innerAudioContext && this.$Http.innerAudioContext.destroy();
  32. },
  33. methods: {
  34. onPostMessage(e) {
  35. console.log("onPostMessage", e);
  36. },
  37. },
  38. };
  39. </script>
  40. <style lang="scss" scoped>
  41. .coverView {
  42. position: fixed;
  43. bottom: 10px;
  44. left: 10px;
  45. color: #fff;
  46. z-index: 999999999;
  47. }
  48. </style>