app
当前应用的 Bundle 类型。
App: "app";macOS 应用程序包
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L43
AppImage: "appimage";Linux AppImage
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L41
Deb: "deb";Linux Debian 软件包
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L37
Msi: "msi";Windows MSI
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L35
Nsis: "nsis";Windows NSIS
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L33
Rpm: "rpm";Linux RPM
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L39
type DataStoreIdentifier: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L9
function defaultWindowIcon(): Promise<Image | null>获取默认窗口图标。
import { defaultWindowIcon } from '@tauri-apps/api/app';await defaultWindowIcon();2.0.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L192
function fetchDataStoreIdentifiers(): Promise<DataStoreIdentifier[]>在 macOS 和 iOS 上获取数据存储标识符。
更多信息请参见 https://developer.apple.com/documentation/webkit/wkwebsitedatastore。
Promise<DataStoreIdentifier[]>
import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app';const ids = await fetchDataStoreIdentifiers();2.4.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L154
function getBundleType(): Promise<BundleType>源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L227
function getIdentifier(): Promise<string>获取应用程序标识符。
Promise<string>
在 tauri.conf.json 中配置的应用程序标识符。
import { getIdentifier } from '@tauri-apps/api/app';const identifier = await getIdentifier();2.4.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L107
function getName(): Promise<string>获取应用程序名称。
Promise<string>
import { getName } from '@tauri-apps/api/app';const appName = await getName();1.0.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L76
function getTauriVersion(): Promise<string>获取 Tauri 版本。
Promise<string>
import { getTauriVersion } from '@tauri-apps/api/app';const tauriVersion = await getTauriVersion();1.0.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L91
function getVersion(): Promise<string>获取应用程序版本。
Promise<string>
import { getVersion } from '@tauri-apps/api/app';const appVersion = await getVersion();1.0.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L62
function hide(): Promise<void>在 macOS 上隐藏应用程序。
Promise<void>
import { hide } from '@tauri-apps/api/app';await hide();1.2.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L137
function removeDataStore(uuid): Promise<DataStoreIdentifier[]>使用给定标识符删除数据存储。
请注意,在运行此 API 之前,应关闭所有使用此数据存储的 webview。
更多信息请参见 https://developer.apple.com/documentation/webkit/wkwebsitedatastore。
| 参数 | 类型 |
|---|---|
uuid | DataStoreIdentifier |
Promise<DataStoreIdentifier[]>
import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app';for (const id of (await fetchDataStoreIdentifiers())) { await removeDataStore(id);}2.4.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L175
function setDockVisibility(visible): Promise<void>设置 macOS 应用程序的 Dock 可见性。
| 参数 | 类型 | 描述 |
|---|---|---|
visible | 布尔值 (boolean) | Dock 是否可见 |
Promise<void>
2.5.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L223
function setTheme(theme?): Promise<void>设置应用程序主题,传入 null 或 undefined 将跟随系统主题
| 参数 | 类型 |
|---|---|
主题? | null | Theme |
Promise<void>
import { setTheme } from '@tauri-apps/api/app';await setTheme('dark');平台特定
- iOS / Android: 不支持。
2.0.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L213
function show(): Promise<void>在 macOS 上显示应用程序。此函数不会自动聚焦任何特定应用程序窗口。
Promise<void>
import { show } from '@tauri-apps/api/app';await show();1.2.0
源: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/app.ts#L122
© 2025 Tauri 贡献者。CC-BY / MIT