<script setup lang="ts">
import { getAboutUs, saveAboutUs } from '@/api/miniprogram'
import { ElMessage } from 'element-plus'

const formData = ref<any>({
  content: ''
})
const formRef = ref(null)

getAboutUs().then((res: any) => {
  formData.value.content = res
})

const handleSave = () => {
  saveAboutUs(formData.value).then(() => {
    ElMessage({
      type: 'success',
      message: '保存成功'
    })
  })
}
</script>

<template>
  <el-form :model="formData" ref="formRef">
    <el-form-item>
      <el-editor v-model="formData.content"></el-editor>
    </el-form-item>
    <el-form-item>
      <div class="text-center w-full"><el-button type="primary" @click="handleSave">保存</el-button></div>
    </el-form-item>
  </el-form>
</template>

<style lang="scss" scoped></style>
