index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <app-layout>
  3. <app-rule
  4. :content="content"
  5. ></app-rule>
  6. </app-layout>
  7. </template>
  8. <script>
  9. import appRule from "../../components/page-component/app-rule/app-rule.vue";
  10. export default {
  11. name: "index",
  12. components: {
  13. 'app-rule': appRule,
  14. },
  15. data() {
  16. return {
  17. content: '',
  18. url: ''
  19. }
  20. },
  21. onLoad(option) {
  22. this.url = decodeURIComponent(option.url);
  23. this.request();
  24. },
  25. methods: {
  26. // 请求配置
  27. async request() {
  28. this.$utils.showLoading();
  29. try {
  30. const res = await this.$request({
  31. url: this.url,
  32. method: 'get'
  33. });
  34. this.$utils.hideLoading();
  35. if (res.code === 0) {
  36. this.content = res.data.content;
  37. } else {
  38. uni.showModal({
  39. title: '提示',
  40. content: res.msg
  41. });
  42. }
  43. } catch (e) {
  44. this.$utils.hideLoading();
  45. }
  46. },
  47. }
  48. }
  49. </script>