Skip to content

Commit 16b60cc

Browse files
committed
wangeditor测试
1 parent 30b9483 commit 16b60cc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<script setup lang="ts">
2+
import axios from 'axios';
3+
declare global {
4+
interface Window {
5+
editor: {
6+
getHtml: () => string;
7+
};
8+
}
9+
}
10+
// 定义 post 请求方法
11+
const sendPostRequest = async () => {
12+
try {
13+
const response = await axios.post('/office/inserthtml', {
14+
html: window.editor.getHtml()
15+
});
16+
console.log('响应数据:', response.data);
17+
} catch (error) {
18+
console.error('请求失败:', error);
19+
}
20+
};
21+
</script>
22+
23+
<template>
24+
<div class="card">
25+
<button type="button" @click="sendPostRequest();">post</button>
26+
</div>
27+
</template>
28+
29+
<style scoped>
30+
.read-the-docs {
31+
color: #888;
32+
}
33+
</style>

0 commit comments

Comments
 (0)