gm-printer 10.33.1 → 10.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -0
- package/package.json +1 -1
- package/src/components/tip/index.js +33 -21
- package/build/demo.js +0 -54
- package/build/index.html +0 -1
package/.eslintcache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"/Users/maoxuanlong/Desktop/guanmai/code/gm-printer1/src/components/tip/index.js":"1"},{"size":1293,"mtime":1760773799171,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1esol1r","/Users/maoxuanlong/Desktop/guanmai/code/gm-printer1/src/components/tip/index.js",[]]
|
package/package.json
CHANGED
|
@@ -7,38 +7,50 @@ import _ from 'lodash'
|
|
|
7
7
|
|
|
8
8
|
const tips = []
|
|
9
9
|
|
|
10
|
-
const Tip =
|
|
10
|
+
const Tip = props => {
|
|
11
11
|
const { list } = props
|
|
12
12
|
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
{_.map(list, (item, index) => {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
key={index}
|
|
19
|
+
className='gm-animated gm-animated-fade-in-right-100'
|
|
20
|
+
>
|
|
21
|
+
<Flex alignCenter className='gm-tip'>
|
|
22
|
+
<SvgInfoCircle className='gm-svg-info' />
|
|
23
|
+
<div style={{ paddingLeft: '10px' }}>
|
|
24
|
+
<div>{item}</div>
|
|
25
|
+
</div>
|
|
26
|
+
</Flex>
|
|
27
|
+
</div>
|
|
28
|
+
)
|
|
29
|
+
})}
|
|
30
|
+
</>
|
|
31
|
+
)
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
function getTipDOM
|
|
30
|
-
return window
|
|
34
|
+
function getTipDOM(id) {
|
|
35
|
+
return window?.shadowRoot?.getElementById(id)
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
Tip.warning = (message = '') => {
|
|
34
39
|
tips.push(message)
|
|
35
|
-
|
|
40
|
+
// TODO 这里要判断是否有dom 避免报错
|
|
36
41
|
setTimeout(() => {
|
|
42
|
+
const dom = getTipDOM('gm-printer-tip')
|
|
37
43
|
tips.shift()
|
|
38
|
-
|
|
44
|
+
if (!dom) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
ReactDOM.render(<Tip list={tips} />)
|
|
39
48
|
}, 3000)
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
const dom = getTipDOM('gm-printer-tip')
|
|
50
|
+
if (!dom) {
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
ReactDOM.render(<Tip list={tips} />, getTipDOM('gm-printer-tip'))
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
Tip.propTypes = {
|