info.vue 936 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="main">
  3. <u-parse class="content" :html="info.content"></u-parse>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. id: 0,
  11. info: {}
  12. }
  13. },
  14. onLoad(options) {
  15. this.id = typeof(options.id) != 'undefined' ? options.id : 0;
  16. if (this.id <= 0) {
  17. this.$u.toast(this.lang.params_error);
  18. setTimeout(function() {
  19. uni.navigateBack({
  20. delta: 1,
  21. })
  22. }, 800);
  23. return false;
  24. }
  25. this.getInfo();
  26. uni.setNavigationBarTitle({
  27. title: this.lang.article_title
  28. })
  29. },
  30. methods: {
  31. getInfo() {
  32. let _this = this
  33. this.$request.sendToken('/api/article/info', {
  34. id: _this.id
  35. }, 'POST').then(res => {
  36. if (res.success == true) {
  37. _this.info = res.data;
  38. } else {
  39. this.$u.toast(res.msg);
  40. }
  41. })
  42. },
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. .content {
  48. color: #f1f1f1;
  49. padding: 38rpx 19rpx;
  50. }
  51. </style>