@tauri-apps/plugin-nfc
枚举
NFCTypeNameFormat
枚举成员
AbsoluteURI
AbsoluteURI: 3;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L84
Empty
Empty: 0;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L81
Media
Media: 2;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L83
NfcExternal
NfcExternal: 4;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L85
NfcWellKnown
NfcWellKnown: 1;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L82
Unchanged
Unchanged: 6;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L87
Unknown
Unknown: 5;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L86
TechKind
枚举成员
IsoDep
IsoDep: 0;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L17
MifareClassic
MifareClassic: 1;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L18
MifareUltralight
MifareUltralight: 2;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L19
Ndef
Ndef: 3;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L20
NdefFormatable
NdefFormatable: 4;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L21
NfcA
NfcA: 5;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L22
NfcB
NfcB: 6;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L23
NfcBarcode
NfcBarcode: 7;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L24
NfcF
NfcF: 8;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L25
NfcV
NfcV: 9;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L26
接口
NFCRecord
属性
ScanOptions
属性
属性 | 类型 | 描述 | 定义于 |
---|---|---|---|
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 |
Tag
属性
TagRecord
属性
UriFilter
属性
WriteOptions
属性
属性 | 类型 | 描述 | 定义于 |
---|---|---|---|
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 |
successfulReadMessage? | string | 读取标签后在 UI 中显示的消息。仅 iOS。 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L75 |
successMessage? | string | 写入消息后在 UI 中显示的消息。仅 iOS。 | 来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L77 |
类型别名
ScanKind
type ScanKind: object | object;
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L29
变量
RTD_TEXT
const RTD_TEXT: number[];
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L7
RTD_URI
const RTD_URI: number[];
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L8
函数
isAvailable()
function isAvailable(): Promise<boolean>
返回值
Promise
<boolean
>
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L271
record()
function record( format, kind, id, payload): NFCRecord
参数
参数 | 类型 |
---|---|
format | NFCTypeNameFormat |
kind | string | number [] |
id | string | number [] |
payload | string | number [] |
返回值
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L110
scan()
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。
参数
参数 | 类型 | 描述 |
---|---|---|
kind | ScanKind | |
options ? | ScanOptions |
返回值
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L231
textRecord()
function textRecord( text, id?, language?): NFCRecord
参数
参数 | 类型 | 默认值 |
---|---|---|
text | string | undefined |
id ? | string | number [] | undefined |
language ? | string | 'en' |
返回值
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L130
uriRecord()
function uriRecord(uri, id?): NFCRecord
参数
参数 | 类型 |
---|---|
uri | string |
id ? | string | number [] |
返回值
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L203
write()
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,它将首先扫描标签,然后写入标签。
参数
参数 | 类型 | 描述 |
---|---|---|
records | NFCRecord [] | |
options ? | WriteOptions |
返回值
Promise
<void
>
来源: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/nfc/guest-js/index.ts#L256
© 2025 Tauri Contributors. CC-BY / MIT