跳到内容
Tauri

@tauri-apps/plugin-nfc

AbsoluteURI: 3;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L84

Empty: 0;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L81

Media: 2;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L83

NfcExternal: 4;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L85

NfcWellKnown: 1;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L82

Unchanged: 6;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L87

Unknown: 5;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L86


IsoDep: 0;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L17

MifareClassic: 1;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L18

MifareUltralight: 2;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L19

Ndef: 3;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L20

NdefFormatable: 4;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L21

NfcA: 5;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L22

NfcB: 6;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L23

NfcBarcode: 7;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L24

NfcF: 8;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L25

NfcV: 9;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L26

属性类型定义于
formatNFCTypeNameFormat来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L104
id数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L106
kind数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L105
payload数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L107

属性类型描述定义于
keepSessionAlive?布尔值 (boolean)-来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L63
message?string在 UI 中显示的消息。仅限 iOS。来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L65
successMessage?string消息读取成功后在 UI 中显示的消息。仅限 iOS。来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L67

属性类型定义于
id数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L98
kindstring[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L99
recordsTagRecord[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L100

属性类型定义于
id数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L93
kind数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L92
payload数字[]来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L94
tnfNFCTypeNameFormat来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L91

属性类型定义于
host?string来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L12
pathPrefix?string来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L13
scheme?string来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L11

属性类型描述定义于
kind?ScanKind-来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L71
message?string读取标签时在 UI 中显示的消息。仅限 iOS。来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L73
successMessage?string消息写入成功后在 UI 中显示的消息。仅限 iOS。来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L77
successfulReadMessage?string标签读取成功后在 UI 中显示的消息。仅限 iOS。来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L75

type ScanKind: object | object;

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L29

const RTD_TEXT: number[];

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L7


const RTD_URI: number[];

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L8

function isAvailable(): Promise<boolean>

Promise<boolean>

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L271


function record(
format,
kind,
id,
payload): NFCRecord
参数类型
formatNFCTypeNameFormat
kindstring | number[]
IDstring | number[]
载荷 (payload)string | number[]

NFCRecord

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L110


function scan(kind, options?): Promise<Tag>

扫描 NFC 标签。

import { scan } from "@tauri-apps/plugin-nfc";
await scan({ type: "tag" });

更多信息请参见 https://developer.android.com.cn/develop/connectivity/nfc/nfc#ndef

参数类型描述
kindScanKind
选项?ScanOptions

Promise<Tag>

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L231


function textRecord(
text,
id?,
language?): NFCRecord
参数类型默认值
textstring未定义
ID?string | number[]未定义
language?string'en'

NFCRecord

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L130


function uriRecord(uri, id?): NFCRecord
参数类型
uristring
ID?string | number[]

NFCRecord

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L203


function write(records, options?): Promise<void>

写入 NFC 标签。

import { uriRecord, write } from "@tauri-apps/plugin-nfc";
await write([uriRecord("https://tauri.org.cn")], { kind: { type: "ndef" } });

如果您之前没有调用过 scan 并将 ScanOptions.keepSessionAlive 设置为 true,它将首先扫描标签,然后进行写入。

参数类型描述
recordsNFCRecord[]
选项?WriteOptions

Promise<void>

来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L256


© 2026 Tauri 贡献者。CC-BY / MIT