2 changed files with 31 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||||
|
<template> |
||||||
|
<div style="display: flex;justify-content: center;align-items: center;margin-top: 100px; width: 50vh; margin-left: 20vh;"> |
||||||
|
<el-input v-model="msg" placeholder="请输入消息内容"></el-input> |
||||||
|
<el-button type="primary" @click="handleClick">发送消息</el-button> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import { ref } from "vue"; |
||||||
|
import { ElMessage } from "element-plus"; |
||||||
|
import { getSendMsg } from "@/api/work"; |
||||||
|
|
||||||
|
const msg = ref(""); |
||||||
|
|
||||||
|
const handleClick = () => { |
||||||
|
const formData = new FormData(); |
||||||
|
formData.append("msg", msg.value); |
||||||
|
getSendMsg(formData).then((res) => { |
||||||
|
console.log(res); |
||||||
|
ElMessage.success("发送成功"); |
||||||
|
}).catch((err) => { |
||||||
|
console.log(err); |
||||||
|
ElMessage.error("发送失败"); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
||||||
Loading…
Reference in new issue