W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
open(: , : ):Promise
path
string
openWith?
string
<void
>
使用系統(tǒng)的默認應用程序打開路徑或 URL, 或用 指定的那個。openWith
該值必須是 、 、 、 、 、 、 或 之一。openWith
firefox
google chrome
chromium
safari
open
start
xdg-open
gio
gnome-open
kde-open
wslview
例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');
Since: 1.0.0
參數(shù)
名字 | 類型 | 描述 |
---|---|---|
path | string | 要打開的路徑或 URL。 此值與 上定義的字符串正則表達式匹配, 該字符串默認為 。 tauri.conf.json > tauri > allowlist > shell > open ^((mailto:\w+)\|(tel:\w+)\|(https?://\w+)).+ |
openWith? | string | 用于打開文件或 URL 的應用。 默認為指定路徑類型的系統(tǒng)默認應用程序。 |
Returns: Promise
<void
>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: