张延森 3 years ago
parent
commit
5a42daa2ac
2 changed files with 3 additions and 2 deletions
  1. 1
    1
      project.config.json
  2. 2
    1
      src/components/barcode/index.jsx

+ 1
- 1
project.config.json View File

@@ -4,7 +4,7 @@
4 4
   "description": "灌南县",
5 5
   "appid": "wx835627a9b9b3932a",
6 6
   "setting": {
7
-    "urlCheck": true,
7
+    "urlCheck": false,
8 8
     "es6": false,
9 9
     "postcss": false,
10 10
     "minified": false

+ 2
- 1
src/components/barcode/index.jsx View File

@@ -8,7 +8,8 @@ import './style.less'
8 8
 export default (props) => {
9 9
   const { code, ratio, height, codeVisible = true } = props
10 10
 
11
-  const id = useMemo(() => Math.random().toString(36).substring(2, 10), [])
11
+  // 使用 createSelectorQuery 有个注意点, id 或者 class 不能以数字开头
12
+  const id = useMemo(() => `canvas-${Math.random().toString(36).substring(2, 10)}`, [])
12 13
   const canvasRef = useRef()
13 14
   const ctxRef = useRef()
14 15