web.vue 567 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <web-view v-if="url.length" :src="url" @error="errorHandle"></web-view>
  3. </template>
  4. <script>
  5. export default {
  6. data() {
  7. return {
  8. url: '',
  9. }
  10. },
  11. onLoad(param) {
  12. if(param.url){
  13. console.log(param.url)
  14. this.url = param.url;
  15. }else{
  16. this.$app.popup.alert('未设定访问地址','访问失败').then(()=>{
  17. this.$app.url.back();
  18. });
  19. }
  20. },
  21. methods:{
  22. errorHandle(e){
  23. this.$app.popup.alert('失败原因\r\n'+e.detail.errMsg,'访问失败').then(()=>{
  24. this.$app.url.back();
  25. });
  26. },
  27. }
  28. }
  29. </script>