web-view.vue 478 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <view>
  3. <web-view :src="url" @message="getMessage"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. url: 'https://uniapp.dcloud.io/static/web-view.html'
  11. }
  12. },
  13. onLoad(options) {
  14. if (options && options.url) {
  15. this.url = options.url;
  16. }
  17. },
  18. methods: {
  19. getMessage(event) {
  20. uni.showModal({
  21. content: JSON.stringify(event.detail),
  22. showCancel: false
  23. });
  24. }
  25. }
  26. }
  27. </script>
  28. <style>
  29. </style>