From 57ca41d4b5330606fe5cf9ea295f9cbe55cbe6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E6=98=A7?= <906751526@qq.com> Date: Thu, 29 Feb 2024 19:38:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?[Issues:=20#I94U70]=20=E6=B7=BB=E5=8A=A0qrc?= =?UTF-8?q?ode-generator=E6=93=8D=E4=BD=9C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/qrcode.md | 169 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 zh-cn/qrcode.md diff --git a/zh-cn/qrcode.md b/zh-cn/qrcode.md new file mode 100644 index 00000000..effc402f --- /dev/null +++ b/zh-cn/qrcode.md @@ -0,0 +1,169 @@ +模板版本:v0.1.3 + +

+

qrcode-generator

+

+

+ + Supported platforms + + + License + + +

+ +[Github 地址](https://github.com/kazuhikoarase/qrcode-generator) +安装与使用 +------------------------------------------------------------------------------------------------------------------------------- + +进入到工程目录并输入以下命令: + +**npm** + +```bash +npm install qrcode-generator +``` + +**yarn** + +```bash +yarn add qrcode-generator +``` + +快速使用: + +```js +import React,{useState,useEffect} from "react"; +import{View,Text,Image} from "react-native" +import QRCode from 'qrcode-generator' + +export const CustomQrCode = ({text,style}) => { + const [base64Img,setBase64Img] = useState('hello word') + useEffect(() => { + const typeNumber = 4 + const errorCorrectionLevel = 'L' + const qr = QRCode(typeNumber,errorCorrectionLevel) + qr.addData(text) + qr.make() + setBase64Img(qr.createDataURL(4,10)) + },[text]) + + return( + base64Img ? : null + ) +} +``` + +约束与限制 +------------------------------------------------------------------------------------------------------------------------------- + +#### 兼容性 + + + +在下述版本验证通过: + + + +1. RNOH:0.72.11; SDK:OpenHarmony(api11) 4.1.0.53; IDE:DevEco Studio 4.1.3.412; ROM:2.0.0.52; +2. RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.58; + +API列表 +------------------------------------------------------------------------------------------------------- + +**以下 `QRCode` 均为qrcode-generator导出的对象,即:** + +```js +import QRCode from 'qrcode-generator'; +``` + +#### Base + +**静态方法** + +"HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 + + + +| Name | Description | Type | Required | HarmonyOS Support | +| --------------------------------------- | ----------- | -------- | -------- | ----------------- | +| QRCode(typeNumber,errorCorrectionLevel) | 创建二维码对象 | function | Yes | Yes | + +**api** + +| Name | Description | Type | Required | HarmonyOS Support | +| -------------------- | ---------------------- | ------ | -------- | ----------------- | +| typeNumber | 二维码类型(1~40,输入 0 以自动检测) | number | Yes | Yes | +| errorCorrectionLevel | 容错级别(L、M、Q、H) | string | Yes | Yes | + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------- | ----------------------------------------------------- | -------- | -------- | ----------------- | +| QRCode.stringToBytes(s) | 将任意字符集的字符串编译成字节序列。这个函数是internal的,重写这个函数可在多字节字符集下编译字符串 | function | Yes | Yes | + +api + +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ----------- | ------ | -------- | ----------------- | +| s | 待编译的字符串 | string | Yes | Yes | + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ------------------------- | ----------- | -------- | -------- | ----------------- | +| QRCode.addData(data,mode) | 添加二维码信息 | function | Yes | Yes | + +api + +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ----------------------------------------------------------------------------------------------------------------- | ------ | -------- | ----------------- | +| data | 二维码信息 | string | Yes | Yes | +| mode | 信息编译模式,可设置为:
Numeric   数字
Alphanumeric 文字数字混合
Byte 字节(默认)
Kanji 日语汉字 | string | No | Yes | + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------- | ---------------------------- | -------- | -------- | ----------------- | +| QRCode.make() | 生成二维码对象(并不显示) | function | Yes | Yes | +| QRCode.getModuleCount() | 获取二维码每行(orientation)的 cell 数 | function | Yes | Yes | +| QRCode.isDark(row,col) | 返回指定行列上的 cell 是否有信息(黑色) | function | Yes | Yes | + +api + +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | -------------------- | ------ | -------- | ----------------- | +| row | 行坐标(0~moduleCount-1) | number | Yes | Yes | +| col | 列坐标(0~moduleCount-1) | number | Yes | Yes | + + + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------------------------- | ------------------------- | -------- | -------- | ----------------- | +| QRCode.createDataURL(cellSize, margin) | 生成base64格式的二维码内容 | function | Yes | Yes | +| QRCode.createImgTag(cellSize, margin,alt) | 生成img标签格式的HTML Helper函数 | function | Yes | Yes | +| QRCode.createSvgTag(cellSize, margin) | 生成svg标签格式的HTML Helper函数 | function | Yes | Yes | +| QRCode.createTableTag(cellSize, margin) | 生成table标签格式的HTML Helper函数 | function | Yes | Yes | +| QRCode.createASCII(cellSize, margin) | 生成ASCII码 | function | Yes | Yes | + +api + +| Name | Description | Type | Required | HarmonyOS Support | +| -------- | --------------------- | -------- | -------- | ----------------- | +| cellSize | cell 像素宽度,默认为 2 | function | No | Yes | +| margin | 补白像素宽度,默认为 cellSize*4 | function | No | Yes | +| alt | image 的提示 | function | No | Yes | + +遗留问题 +--------------------------------------------------------------------------------------------------------------------- + +其他 +------------------------------------------------------------------------------------------------- + +开源协议 +--------------------------------------------------------------------------------------------------------------------- + +本项目基于 [MIT License](https://github.com/brix/crypto-js/blob/4.2.0/LICENSE) ,请自由地享受和参与开源。 -- Gitee From 2a56c3aa3a1dbff022257e58fc499726cb25615f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E6=98=A7?= <906751526@qq.com> Date: Fri, 1 Mar 2024 11:23:00 +0800 Subject: [PATCH 2/6] =?UTF-8?q?[Issues:=20#I94U70]=20=E6=B7=BB=E5=8A=A0qrc?= =?UTF-8?q?ode-generator=E6=93=8D=E4=BD=9C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/{qrcode.md => qrcode-generator.md} | 121 +++++++++++------------ 1 file changed, 56 insertions(+), 65 deletions(-) rename zh-cn/{qrcode.md => qrcode-generator.md} (36%) diff --git a/zh-cn/qrcode.md b/zh-cn/qrcode-generator.md similarity index 36% rename from zh-cn/qrcode.md rename to zh-cn/qrcode-generator.md index effc402f..1398c1a9 100644 --- a/zh-cn/qrcode.md +++ b/zh-cn/qrcode-generator.md @@ -1,31 +1,29 @@ -模板版本:v0.1.3 +> 模板版本:v0.1.2

qrcode-generator

- - Supported platforms - - + License -

-[Github 地址](https://github.com/kazuhikoarase/qrcode-generator) -安装与使用 -------------------------------------------------------------------------------------------------------------------------------- +> [!tip] [Github 地址](https://github.com/kazuhikoarase/qrcode-generator) + +## 安装与使用 + + 进入到工程目录并输入以下命令: -**npm** +#### **npm** ```bash npm install qrcode-generator ``` -**yarn** +#### **yarn** ```bash yarn add qrcode-generator @@ -58,13 +56,9 @@ export const CustomQrCode = ({text,style}) => { 约束与限制 ------------------------------------------------------------------------------------------------------------------------------- -#### 兼容性 - - - -在下述版本验证通过: - +### 兼容性 +在下述版本验证通过: 1. RNOH:0.72.11; SDK:OpenHarmony(api11) 4.1.0.53; IDE:DevEco Studio 4.1.3.412; ROM:2.0.0.52; 2. RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.58; @@ -86,84 +80,81 @@ import QRCode from 'qrcode-generator'; -| Name | Description | Type | Required | HarmonyOS Support | -| --------------------------------------- | ----------- | -------- | -------- | ----------------- | -| QRCode(typeNumber,errorCorrectionLevel) | 创建二维码对象 | function | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| --------------------------------------- | ----------------------- | -------- | -------- | ----------------- | +| QRCode(typeNumber,errorCorrectionLevel) | Create a QRCode Object. | function | Yes | Yes | **api** -| Name | Description | Type | Required | HarmonyOS Support | -| -------------------- | ---------------------- | ------ | -------- | ----------------- | -| typeNumber | 二维码类型(1~40,输入 0 以自动检测) | number | Yes | Yes | -| errorCorrectionLevel | 容错级别(L、M、Q、H) | string | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| -------------------- | ---------------------------------------------- | ------ | -------- | ----------------- | +| typeNumber | Type number (1 ~ 40), or 0 for auto detection. | number | Yes | Yes | +| errorCorrectionLevel | Error correction level ('L', 'M', 'Q', 'H') | string | Yes | Yes | **静态方法** -| Name | Description | Type | Required | HarmonyOS Support | -| ----------------------- | ----------------------------------------------------- | -------- | -------- | ----------------- | -| QRCode.stringToBytes(s) | 将任意字符集的字符串编译成字节序列。这个函数是internal的,重写这个函数可在多字节字符集下编译字符串 | function | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------------- | +| QRCode.stringToBytes(s) | Encodes a string into an array of number(byte) using any charset. This function is used by internal. Overwrite this function to encode using a multibyte charset. | function | Yes | Yes | api -| Name | Description | Type | Required | HarmonyOS Support | -| ---- | ----------- | ------ | -------- | ----------------- | -| s | 待编译的字符串 | string | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ---------------- | ------ | -------- | ----------------- | +| s | string to encode | string | Yes | Yes | **静态方法** -| Name | Description | Type | Required | HarmonyOS Support | -| ------------------------- | ----------- | -------- | -------- | ----------------- | -| QRCode.addData(data,mode) | 添加二维码信息 | function | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ------------------------- | --------------------- | -------- | -------- | ----------------- | +| QRCode.addData(data,mode) | Add a data to encode. | function | Yes | Yes | api -| Name | Description | Type | Required | HarmonyOS Support | -| ---- | ----------------------------------------------------------------------------------------------------------------- | ------ | -------- | ----------------- | -| data | 二维码信息 | string | Yes | Yes | -| mode | 信息编译模式,可设置为:
Numeric   数字
Alphanumeric 文字数字混合
Byte 字节(默认)
Kanji 日语汉字 | string | No | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ---------------------------------------------------------- | ------ | -------- | ----------------- | +| data | string to encode | string | Yes | Yes | +| mode | Mode ('Numeric', 'Alphanumeric', 'Byte'(default), 'Kanji') | Yes | | | **静态方法** -| Name | Description | Type | Required | HarmonyOS Support | -| ----------------------- | ---------------------------- | -------- | -------- | ----------------- | -| QRCode.make() | 生成二维码对象(并不显示) | function | Yes | Yes | -| QRCode.getModuleCount() | 获取二维码每行(orientation)的 cell 数 | function | Yes | Yes | -| QRCode.isDark(row,col) | 返回指定行列上的 cell 是否有信息(黑色) | function | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------- | ------------------------------------------------------------------------------------------- | -------- | -------- | ----------------- | +| QRCode.make() | Make a QR Code. | function | Yes | Yes | +| QRCode.getModuleCount() | The number of modules(cells) for each orientation. [Note] call make() before this function. | function | Yes | Yes | +| QRCode.isDark(row,col) | The module at row and col is dark or not. [Note] call make() before this function. | function | Yes | Yes | -api +**api** -| Name | Description | Type | Required | HarmonyOS Support | -| ---- | -------------------- | ------ | -------- | ----------------- | -| row | 行坐标(0~moduleCount-1) | number | Yes | Yes | -| col | 列坐标(0~moduleCount-1) | number | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ------------------- | ------ | -------- | ----------------- | +| row | 0 ~ moduleCount - 1 | number | Yes | Yes | +| col | 0 ~ moduleCount - 1 | number | Yes | Yes | **静态方法** -| Name | Description | Type | Required | HarmonyOS Support | -| ----------------------------------------- | ------------------------- | -------- | -------- | ----------------- | -| QRCode.createDataURL(cellSize, margin) | 生成base64格式的二维码内容 | function | Yes | Yes | -| QRCode.createImgTag(cellSize, margin,alt) | 生成img标签格式的HTML Helper函数 | function | Yes | Yes | -| QRCode.createSvgTag(cellSize, margin) | 生成svg标签格式的HTML Helper函数 | function | Yes | Yes | -| QRCode.createTableTag(cellSize, margin) | 生成table标签格式的HTML Helper函数 | function | Yes | Yes | -| QRCode.createASCII(cellSize, margin) | 生成ASCII码 | function | Yes | Yes | +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | -------- | ----------------- | +| QRCode.createDataURL(cellSize, margin) | Generate base64 links,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createImgTag(cellSize, margin,alt) | Generate img tag QR code,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createSvgTag(cellSize, margin) | Generate QR codes for svg tags,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createTableTag(cellSize, margin) | Generate QR codes for table tags,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createASCII(cellSize, margin) | Generate ASCII code,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | -api +**api** | Name | Description | Type | Required | HarmonyOS Support | | -------- | --------------------- | -------- | -------- | ----------------- | -| cellSize | cell 像素宽度,默认为 2 | function | No | Yes | -| margin | 补白像素宽度,默认为 cellSize*4 | function | No | Yes | -| alt | image 的提示 | function | No | Yes | +| cellSize | default: 2 | function | No | Yes | +| margin | default: cellSize * 4 | function | No | Yes | +| alt | (optional) | function | No | Yes | -遗留问题 ---------------------------------------------------------------------------------------------------------------------- +## 遗留问题 -其他 -------------------------------------------------------------------------------------------------- +## 其他 -开源协议 ---------------------------------------------------------------------------------------------------------------------- +## 开源协议 -本项目基于 [MIT License](https://github.com/brix/crypto-js/blob/4.2.0/LICENSE) ,请自由地享受和参与开源。 +本项目基于 [The MIT License (MIT)](https://github.com/facebook/prop-types/blob/v15.8.1/LICENSE) ,请自由地享受和参与开源。 -- Gitee From 240282b5f4c99393b5f4b3cac037ba960048f629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E6=98=A7?= <906751526@qq.com> Date: Fri, 1 Mar 2024 15:10:37 +0800 Subject: [PATCH 3/6] =?UTF-8?q?[Issues:=20#I94U70]=20=E6=B7=BB=E5=8A=A0qrc?= =?UTF-8?q?ode-generator=E6=93=8D=E4=BD=9C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/qrcode-generator.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zh-cn/qrcode-generator.md b/zh-cn/qrcode-generator.md index 1398c1a9..3b34252c 100644 --- a/zh-cn/qrcode-generator.md +++ b/zh-cn/qrcode-generator.md @@ -20,13 +20,13 @@ #### **npm** ```bash -npm install qrcode-generator +npm install qrcode-generator@1.4.4 ``` #### **yarn** ```bash -yarn add qrcode-generator +yarn add qrcode-generator@1.4.4 ``` 快速使用: @@ -60,8 +60,7 @@ export const CustomQrCode = ({text,style}) => { 在下述版本验证通过: -1. RNOH:0.72.11; SDK:OpenHarmony(api11) 4.1.0.53; IDE:DevEco Studio 4.1.3.412; ROM:2.0.0.52; -2. RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.58; +1. RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.59; API列表 ------------------------------------------------------------------------------------------------------- -- Gitee From 90e6d5d48b0bf1e08e93dcbafd3cc46a49811fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E6=98=A7?= <906751526@qq.com> Date: Fri, 1 Mar 2024 15:11:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?[Issues:=20#I94U70]=20=E6=B7=BB=E5=8A=A0qrc?= =?UTF-8?q?ode-generator=E6=93=8D=E4=BD=9C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/qrcode-generator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/qrcode-generator.md b/zh-cn/qrcode-generator.md index 3b34252c..665a2918 100644 --- a/zh-cn/qrcode-generator.md +++ b/zh-cn/qrcode-generator.md @@ -1,4 +1,4 @@ -> 模板版本:v0.1.2 +> 模板版本:v0.1.3

qrcode-generator

-- Gitee From 7498f99043812ca1e6251368df7f2a4e204fe998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E6=98=A7?= <906751526@qq.com> Date: Thu, 28 Mar 2024 17:47:17 +0800 Subject: [PATCH 5/6] =?UTF-8?q?[Issues:=20#I9CG05]=20=E6=B7=BB=E5=8A=A0rea?= =?UTF-8?q?ct-native-image-viewing=E6=93=8D=E4=BD=9C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/react-native-image-viewing.md | 96 +++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 zh-cn/react-native-image-viewing.md diff --git a/zh-cn/react-native-image-viewing.md b/zh-cn/react-native-image-viewing.md new file mode 100644 index 00000000..d5234327 --- /dev/null +++ b/zh-cn/react-native-image-viewing.md @@ -0,0 +1,96 @@ +> 模板版本:v0.1.2 + +

+

react-native-image-viewing

+

+

+ + License + +

+ +> [!tip] [Github 地址][https://github.com/jobtoday/react-native-image-viewing] + +## 安装与使用 + + + +进入到工程目录并输入以下命令: + +#### **npm** + +```bash +npm install react-native-image-viewing@0.2.2 +``` + +#### **yarn** + +```bash +yarn add react-native-image-viewing@0.2.2 +``` + +快速使用: + +```js +import ImageView from "react-native-image-viewing"; + +const images = [ + { + uri: "https://images.unsplash.com/photo-1571501679680-de32f1e7aad4", + }, + { + uri: "https://images.unsplash.com/photo-1573273787173-0eb81a833b34", + }, + { + uri: "https://images.unsplash.com/photo-1569569970363-df7b6160d111", + }, +]; + +const [visible, setIsVisible] = useState(false); + + setIsVisible(false)} +/> +``` + +约束与限制 +------------------------------------------------------------------------------------------------------------------------------- + +### 兼容性 + +在下述版本验证通过: + +1. RNOH:0.72.5; SDK:HarmonyOS NEXT DP2; IDE:DevEco Studio 4.1.3.700; ROM:204.1.0.72(SP2DEVC00E72R1P1); + +API列表 +------------------------------------------------------------------------------------------------------- + + +| Name | Description | Type | Required | HarmonyOS Support | +| ---------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | -------- | ----------------- | +| images | Array of images to display | ImageSource[] | Yes | Yes | +| keyExtractor | Uniqely identifying each image | (imageSrc: ImageSource, index: number) => string | No | Yes | +| imageIndex | Current index of image to display | number | Yes | Yes | +| visible | Is modal shown or not | boolean | No | Yes | +| onRequestClose | Function called to close the modal | function | Yes | Yes | +| onImageIndexChange | Function called when image index has been changed | function | No | Yes | +| onLongPress | Function called when image long pressed | function (event: GestureResponderEvent, image: ImageSource) | No | Yes | +| delayLongPress | Delay in ms, before onLongPress is called: default | number | No | Yes | +| animationType | Animation modal presented with: default | none, fade, slide | No | Yes | +| presentationStyle | Modal presentation style: default: fullScreen Android: Use overFullScreen to hide StatusBar | fullScreen, pageSheet, formSheet, overFullScreen | No | Yes | +| backgroundColor | Background color of the modal in HEX | string | No | Yes | +| swipeToCloseEnabled | Close modal with swipe up or down: default | boolean | No | Yes | +| doubleTapToZoomEnabled | Zoom image by double tap on it: default | boolean | No | Yes | +| HeaderComponent | Header component, gets current imageIndex as a prop | component, function | No | Yes | +| FooterComponent | Footer component, gets current imageIndex as a prop | component, function | No | Yes | + +## 遗留问题 + +## 其他 + +## 开源协议 + +本项目基于 [The MIT License (MIT)](https://github.com/facebook/prop-types/blob/v15.8.1/LICENSE) ,请自由地享受和参与开源。 -- Gitee From 3c640081009adb7e1c6a16053dc1ca3a79dd8f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E6=98=A7?= <906751526@qq.com> Date: Fri, 29 Mar 2024 15:06:08 +0800 Subject: [PATCH 6/6] =?UTF-8?q?[Issues:=20#I9COIO]=20=E6=B7=BB=E5=8A=A0qrc?= =?UTF-8?q?ode-generator=E6=93=8D=E4=BD=9C=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1224/qrcode-generator.md | 159 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 1224/qrcode-generator.md diff --git a/1224/qrcode-generator.md b/1224/qrcode-generator.md new file mode 100644 index 00000000..665a2918 --- /dev/null +++ b/1224/qrcode-generator.md @@ -0,0 +1,159 @@ +> 模板版本:v0.1.3 + +

+

qrcode-generator

+

+

+ + License + +

+ +> [!tip] [Github 地址](https://github.com/kazuhikoarase/qrcode-generator) + +## 安装与使用 + + + +进入到工程目录并输入以下命令: + +#### **npm** + +```bash +npm install qrcode-generator@1.4.4 +``` + +#### **yarn** + +```bash +yarn add qrcode-generator@1.4.4 +``` + +快速使用: + +```js +import React,{useState,useEffect} from "react"; +import{View,Text,Image} from "react-native" +import QRCode from 'qrcode-generator' + +export const CustomQrCode = ({text,style}) => { + const [base64Img,setBase64Img] = useState('hello word') + useEffect(() => { + const typeNumber = 4 + const errorCorrectionLevel = 'L' + const qr = QRCode(typeNumber,errorCorrectionLevel) + qr.addData(text) + qr.make() + setBase64Img(qr.createDataURL(4,10)) + },[text]) + + return( + base64Img ? : null + ) +} +``` + +约束与限制 +------------------------------------------------------------------------------------------------------------------------------- + +### 兼容性 + +在下述版本验证通过: + +1. RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.59; + +API列表 +------------------------------------------------------------------------------------------------------- + +**以下 `QRCode` 均为qrcode-generator导出的对象,即:** + +```js +import QRCode from 'qrcode-generator'; +``` + +#### Base + +**静态方法** + +"HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 + + + +| Name | Description | Type | Required | HarmonyOS Support | +| --------------------------------------- | ----------------------- | -------- | -------- | ----------------- | +| QRCode(typeNumber,errorCorrectionLevel) | Create a QRCode Object. | function | Yes | Yes | + +**api** + +| Name | Description | Type | Required | HarmonyOS Support | +| -------------------- | ---------------------------------------------- | ------ | -------- | ----------------- | +| typeNumber | Type number (1 ~ 40), or 0 for auto detection. | number | Yes | Yes | +| errorCorrectionLevel | Error correction level ('L', 'M', 'Q', 'H') | string | Yes | Yes | + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------------- | +| QRCode.stringToBytes(s) | Encodes a string into an array of number(byte) using any charset. This function is used by internal. Overwrite this function to encode using a multibyte charset. | function | Yes | Yes | + +api + +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ---------------- | ------ | -------- | ----------------- | +| s | string to encode | string | Yes | Yes | + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ------------------------- | --------------------- | -------- | -------- | ----------------- | +| QRCode.addData(data,mode) | Add a data to encode. | function | Yes | Yes | + +api + +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ---------------------------------------------------------- | ------ | -------- | ----------------- | +| data | string to encode | string | Yes | Yes | +| mode | Mode ('Numeric', 'Alphanumeric', 'Byte'(default), 'Kanji') | Yes | | | + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------- | ------------------------------------------------------------------------------------------- | -------- | -------- | ----------------- | +| QRCode.make() | Make a QR Code. | function | Yes | Yes | +| QRCode.getModuleCount() | The number of modules(cells) for each orientation. [Note] call make() before this function. | function | Yes | Yes | +| QRCode.isDark(row,col) | The module at row and col is dark or not. [Note] call make() before this function. | function | Yes | Yes | + +**api** + +| Name | Description | Type | Required | HarmonyOS Support | +| ---- | ------------------- | ------ | -------- | ----------------- | +| row | 0 ~ moduleCount - 1 | number | Yes | Yes | +| col | 0 ~ moduleCount - 1 | number | Yes | Yes | + + + +**静态方法** + +| Name | Description | Type | Required | HarmonyOS Support | +| ----------------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | -------- | ----------------- | +| QRCode.createDataURL(cellSize, margin) | Generate base64 links,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createImgTag(cellSize, margin,alt) | Generate img tag QR code,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createSvgTag(cellSize, margin) | Generate QR codes for svg tags,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createTableTag(cellSize, margin) | Generate QR codes for table tags,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | +| QRCode.createASCII(cellSize, margin) | Generate ASCII code,Helper functions for HTML. [Note] call make() before these functions. | function | Yes | Yes | + +**api** + +| Name | Description | Type | Required | HarmonyOS Support | +| -------- | --------------------- | -------- | -------- | ----------------- | +| cellSize | default: 2 | function | No | Yes | +| margin | default: cellSize * 4 | function | No | Yes | +| alt | (optional) | function | No | Yes | + +## 遗留问题 + +## 其他 + +## 开源协议 + +本项目基于 [The MIT License (MIT)](https://github.com/facebook/prop-types/blob/v15.8.1/LICENSE) ,请自由地享受和参与开源。 -- Gitee