webview.vue 742 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!-- 网络链接内容展示页(uni-id-pages中用于展示隐私政策协议内容) -->
  2. <template>
  3. <view>
  4. <web-view v-if="url" :src="url"></web-view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. onLoad({url,title}) {
  10. if(url.substring(0, 4) != 'http'){
  11. uni.showModal({
  12. title:"错误",
  13. content: '不是一个有效的网站链接,'+'"'+url+'"',
  14. showCancel: false,
  15. confirmText:"知道了",
  16. complete: () => {
  17. uni.navigateBack()
  18. }
  19. });
  20. title = "页面路径错误"
  21. }else{
  22. console.log(url,title);
  23. this.url = url;
  24. }
  25. if(title){
  26. uni.setNavigationBarTitle({title});
  27. }
  28. },
  29. data() {
  30. return {
  31. url:null
  32. };
  33. }
  34. }
  35. </script>
  36. <style lang="scss">
  37. </style>