detail.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="safe-area-inset-bottom">
  3. <view class="flex justify-end padding-30">
  4. <view @click="edit" class="cu-btn radius sm bg-base">
  5. 编辑
  6. </view>
  7. </view>
  8. <view class="text-area" v-html="content"></view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. id: '',
  16. content: '',
  17. detail: {}
  18. }
  19. },
  20. onLoad(options) {
  21. this.id = options.id
  22. this.fetchDetail()
  23. },
  24. onShow() {
  25. this.fetchDetail()
  26. },
  27. methods: {
  28. edit(){
  29. uni.navigateTo({
  30. url:"notice?id="+this.id
  31. })
  32. },
  33. async fetchDetail() {
  34. let params = {
  35. id: this.id
  36. }
  37. let res=await this.$api.notice.detail(params)
  38. this.detail = res.data || {}
  39. this.content = decodeURIComponent(this.detail.content)
  40. if (this.$isNotEmpty(this.detail.title)) {
  41. uni.setNavigationBarTitle({
  42. title:this.detail.title
  43. })
  44. }
  45. }
  46. }
  47. }
  48. </script>
  49. <style>
  50. page {
  51. background-color: #FFFFFF;
  52. }
  53. </style>
  54. <style lang="scss" scoped>
  55. .text-area {
  56. padding: 20rpx;
  57. }
  58. .title{
  59. text-align: center;
  60. font-size: 34rpx;
  61. font-weight: 800;
  62. }
  63. </style>