添加朋友圈功能
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<script setup>
|
||||
import { reactive } from 'vue'
|
||||
import { addUserMoments } from '@/api/my-index'
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { navigateBack } from '@/utils/router'
|
||||
|
||||
const placeholderStyle = `font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 500;
|
||||
@@ -9,13 +12,31 @@ line-height: 40rpx;
|
||||
font-style: normal;
|
||||
text-transform: none;`
|
||||
|
||||
const { showToast } = useUI()
|
||||
|
||||
const formData = reactive({
|
||||
txt: '',
|
||||
listImg: []
|
||||
})
|
||||
|
||||
const onUpData = () => {
|
||||
console.log(formData)
|
||||
const onUpData = async () => {
|
||||
if (!formData.txt) {
|
||||
showToast('请输入内容')
|
||||
return
|
||||
}
|
||||
|
||||
await addUserMoments({
|
||||
content: formData.txt,
|
||||
privacy: 0,
|
||||
images: formData.listImg.map(v => {
|
||||
return {
|
||||
imageUrl: v
|
||||
}
|
||||
})
|
||||
})
|
||||
await showToast('发布成功', 'success')
|
||||
|
||||
navigateBack()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user