<template>
  <view class="article">
    <u-parse :content="content"></u-parse>
  </view>
</template>

<script>
import {getNewsRead} from "@/common/api/news.js";

export default {
  data() {
    return {
      id: "",
      content: undefined,
    };
  },
  onLoad(options) {
    uni.hideShareMenu({});
    if (options.id) {
      this.id = options.id;
      this.getData();
    }
  },
  methods: {
    getData() {
      const data = {
        name: this.name,
      };
      getNewsRead({
        id: this.id,
      }).then(({data = {}}) => {
        uni.setNavigationBarTitle({
          title: data.name,
        });
        this.content = data.content;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.article {
  width: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 20rpx 20rpx 40rpx;
  box-sizing: border-box;
  text-align: justify;
}
</style>
