<template>
  <view class="rich-text">
    <mp-html :content="richText" />
  </view>
</template>

<script setup lang="ts">
  import { ref } from 'vue'
  import { onLoad } from '@dcloudio/uni-app'
  import { editorApi } from '@/api/other.ts'
  const props = defineProps<{
    title ?: string
    content : string
  }>()
  const content = decodeURIComponent(props.content)
  const richText = ref()
  const title = ref()
  const params = {
    key: 'expoApply'
  }

  onLoad(() => {
    editor()
  })
  // 设置页面标题
  // if (props.title) {
  //   // uni.setNavigationBarTitle({ title: props.title })
  // }
  // 请求
  const editor = () => {
    editorApi(params).then(res => {
      if (res.code == 1) {
        richText.value = res.data.editor
        uni.setNavigationBarTitle({ title: res.data.title })
      }
    })
  }

</script>


<style scoped lang="scss">
  .rich-text {
    padding: 30rpx;
    text-indent: 60rpx;
  }
</style>
