forked from jdf2e/nutui-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(barrage): demo拆解与规范 (jdf2e#2098)
* fix(Barrage): demo拆解与规范 * chore: update --------- Co-authored-by: oasis-cloud <[email protected]>
- Loading branch information
1 parent
656d834
commit 145e615
Showing
8 changed files
with
78 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useRef } from 'react' | ||
import { Cell, Button, Barrage } from '@nutui/nutui-react' | ||
|
||
const Demo1 = () => { | ||
const barrageList = [ | ||
'画美不看画美不看画美不看画美不看', | ||
'不明觉厉', | ||
'喜大普奔', | ||
'男默女泪', | ||
'累觉不爱', | ||
'爷青结', | ||
] | ||
const barrageRef = useRef<any>(null) | ||
const addBarrage = () => { | ||
const n = Math.random() | ||
if (barrageRef.current) { | ||
barrageRef.current.add(`随机——${String(n).substr(2, 10)}`) | ||
} | ||
} | ||
return ( | ||
<> | ||
<Cell className="barrage-demo-wrap"> | ||
<Barrage className="barrage-demo" ref={barrageRef} list={barrageList} /> | ||
</Cell> | ||
<div className="test" style={{ textAlign: 'center' }}> | ||
<Button type="primary" onClick={addBarrage}> | ||
随机添加 | ||
</Button> | ||
</div> | ||
</> | ||
) | ||
} | ||
export default Demo1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useRef } from 'react' | ||
import { Cell, Button, Barrage } from '@nutui/nutui-react-taro' | ||
|
||
const Demo1 = () => { | ||
const barrageList = [ | ||
'画美不看画美不看画美不看画美不看', | ||
'不明觉厉', | ||
'喜大普奔', | ||
'男默女泪', | ||
'累觉不爱', | ||
'爷青结', | ||
] | ||
const barrageRef = useRef<any>(null) | ||
const addBarrage = () => { | ||
const n = Math.random() | ||
if (barrageRef.current) { | ||
barrageRef.current.add(`随机——${String(n).substr(2, 10)}`) | ||
} | ||
} | ||
return ( | ||
<> | ||
<Cell className="barrage-demo-wrap"> | ||
<Barrage className="barrage-demo" ref={barrageRef} list={barrageList} /> | ||
</Cell> | ||
<div className="test" style={{ textAlign: 'center' }}> | ||
<Button type="primary" onClick={addBarrage}> | ||
随机添加 | ||
</Button> | ||
</div> | ||
</> | ||
) | ||
} | ||
export default Demo1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.