tauri开发软件中,使用tauri自带的api用浏览器打开指定的url链接

436 阅读1分钟

有能力的可以看官方文档:shell | Tauri Apps

就是使用这个api来打开指定的url链接,要在tauri.config.json中配置打开这个api:

然后在前端页面中导入使用:

import { open } from '@tauri-apps/api/shell';
// opens the given URL on the default browser:
await open('https://github.com/tauri-apps/tauri');
// opens the given URL using `firefox`:
await open('https://github.com/tauri-apps/tauri', 'firefox');
// opens a file using the default program:
await open('/path/to/file');