error.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="error-page">
  3. <s-empty
  4. v-if="errCode === 'NetworkError'"
  5. icon="/static/internet-empty.png"
  6. text="网络连接失败"
  7. showAction
  8. actionText="重新连接"
  9. @clickAction="onReconnect"
  10. buttonColor="#ff3000"
  11. ></s-empty>
  12. <s-empty
  13. v-else-if="errCode === 'TemplateError'"
  14. icon="/static/internet-empty.png"
  15. text="未找到模板"
  16. showAction
  17. actionText="重新加载"
  18. @clickAction="onReconnect"
  19. buttonColor="#ff3000"
  20. ></s-empty>
  21. <s-empty
  22. v-else-if="errCode !== ''"
  23. icon="/static/internet-empty.png"
  24. :text="errMsg"
  25. showAction
  26. actionText="重新加载"
  27. @clickAction="onReconnect"
  28. buttonColor="#ff3000"
  29. ></s-empty>
  30. </view>
  31. </template>
  32. <script setup>
  33. import { onLoad } from '@dcloudio/uni-app';
  34. import { ref } from 'vue';
  35. import { ShoproInit } from '@/sheep';
  36. const errCode = ref('');
  37. const errMsg = ref('');
  38. onLoad((options) => {
  39. errCode.value = options.errCode;
  40. errMsg.value = options.errMsg;
  41. });
  42. // 重新连接
  43. async function onReconnect() {
  44. uni.reLaunch({
  45. url: '/pages/index/index',
  46. });
  47. ShoproInit();
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .error-page {
  52. width: 100%;
  53. }
  54. </style>