https://gitcode.com/Resource-Bundle-Collection/7248a/?utm_source=pan_gitcode&index=bottom&type=card&
{
"usingComponents": {
"hg-editor": "/components/hg-editor/hg-editor"
}
}<hg-editor showTabBar="{{true}}" placeholder="请输入相关内容" name="editor1" uploadImageURL="https://your-upload-url.com"></hg-editor>// main.js
const { app, BrowserWindow } = require('electron');
const { exec } = require('child_process');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
});
// 示例:执行 macOS 命令 `say Hello`
exec('say "Hello from Electron"', (error, stdout, stderr) => {
if (error) {
console.error(`执行出错: ${error}`);
return;
}
console.log(`输出: ${stdout}`);
});
win.loadURL('https://example.com');
}
app.whenReady().then(createWindow);渲染进程一样可以
const { exec } = require('child_process');
function runexecCommand() {
exec('diskutil erasevolume HFS+ \\"RamDisk\\" `hdiutil attach -nomount ram://8388608`', (error, stdout, stderr) => {
if (error) {
console.error(`执行出错: ${error}`);
return;
}
console.log(`输出: ${stdout}`);
});
}defaults write com.apple.Dock orientation "bottom" && defaults write com.apple.Dock pinned -int 1 && killall Dock
# @app.post("/post-data/", include_in_schema=False) 这样不出现文档内
#
@app.post("/post-data/")
async def get_post_data(request: Request):
"""
获取特定物品的信息。这里自己写注释内容 访问/docs 即可查看
- **item_id**: 物品的 ID
- **q**: 可选的查询参数,用于过滤物品
"""
# 获取请求体的字节数据
body = await request.body()
# 将字节数据解码为字符串
body_str = body.decode('utf-8')
# 获取请求的所有头信息
headers = dict(request.headers)
# 获取请求的查询参数
query_params = dict(request.query_params)
sqlSelect = execute_sql('select * from user')
print(sqlSelect)
cache = get_cache("sdqysoftallRolesJson")
return {
"body": body_str,
"headers": headers,
"query_params": query_params
}http://127.0.0.1:8000/docs