跳到内容
Tauri

@tauri-apps/plugin-nfc

AbsoluteURI: 3;

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

Empty: 0;

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

Media: 2;

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

NfcExternal: 4;

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

NfcWellKnown: 1;

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

Unchanged: 6;

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

Unknown: 5;

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


IsoDep: 0;

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

MifareClassic: 1;

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

MifareUltralight: 2;

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

Ndef: 3;

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

NdefFormatable: 4;

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

NfcA: 5;

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

NfcB: 6;

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

NfcBarcode: 7;

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

NfcF: 8;

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

NfcV: 9;

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

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

属性类型描述定义于
keepSessionAlive?布尔值 (boolean)-Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L63
message?stringUI 中显示的消息。仅限 iOS。Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L65
successMessage?stringUI 中显示的消息,当消息被读取时显示。仅限 iOS。Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L67

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

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

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

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

type ScanKind: object | object;

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

const RTD_TEXT: number[];

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


const RTD_URI: number[];

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

function isAvailable(): Promise<boolean>

Promise<boolean>

Source: 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

Source: 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>

Source: 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

Source: 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

Source: 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>

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


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