webview-test.ts 590 B

1234567891011121314151617181920212223242526272829
  1. type WebViewTestPageData = {
  2. webViewSrc: string
  3. webViewReady: boolean
  4. }
  5. const WEB_VIEW_TEST_URL = 'https://oss-mbh5.colormaprun.com/gotomars/h5/content-h5-test-template.html'
  6. Page<WebViewTestPageData, WechatMiniprogram.IAnyObject>({
  7. data: {
  8. webViewSrc: '',
  9. webViewReady: false,
  10. },
  11. onLoad() {
  12. this.setData({
  13. webViewSrc: WEB_VIEW_TEST_URL,
  14. webViewReady: true,
  15. })
  16. },
  17. handleWebViewError() {
  18. wx.showModal({
  19. title: 'H5 打开失败',
  20. content: WEB_VIEW_TEST_URL,
  21. showCancel: false,
  22. confirmText: '知道了',
  23. })
  24. },
  25. })