æ·feat: commplete init process
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import useClipboard from "vue-clipboard3";
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
function copyToClipboard(obj) {
|
||||
const { toClipboard } = useClipboard();
|
||||
try {
|
||||
if (!obj) {
|
||||
ElMessage({
|
||||
message: `复制内容为空`,
|
||||
type: 'error',
|
||||
})
|
||||
} else {
|
||||
toClipboard(obj);
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage({
|
||||
message: `复制失败,${e}`,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
export { copyToClipboard };
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
const gethttpOrigin = () => {
|
||||
return window.location.origin
|
||||
}
|
||||
|
||||
class ApiStrGenerate {
|
||||
|
||||
|
||||
static getCurlString(task_id, options) {
|
||||
let data = { task_id: task_id };
|
||||
data.text = 'Hello World!';
|
||||
if (options.html) {
|
||||
data.html = '<h1> Hello World! </h1>';
|
||||
}
|
||||
if (options.markdown) {
|
||||
data.html = '** Hello World! **';
|
||||
}
|
||||
let dataStr = JSON.stringify(data, null, 4)
|
||||
let example = `curl -X POST --location '${gethttpOrigin()}/api/v1/message/send' \\
|
||||
--header 'Accept: application/json' \\
|
||||
--data '${dataStr}'`;
|
||||
return example;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { ApiStrGenerate };
|
||||
Reference in New Issue
Block a user