-
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yang
committed
Dec 5, 2023
1 parent
bc8e939
commit 40034db
Showing
11 changed files
with
177 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"input":{"AutoHeight":"6","Basic":"1","Clearable":"2","Disabled":"5","Native":"3","ReadOnly":"4","ShowLength":"7","Vertical":"8","Readonly":"4","Disable":0},"swipe-action":{"Basic":0}} | ||
{"input":{"AutoHeight":"6","Basic":"1","Clearable":"2","Disabled":"5","Native":"3","ReadOnly":"4","ShowLength":"7","Vertical":"8","Readonly":"4","Disable":0},"swipe-action":{"Basic":0},"checkbox":{"Controlled":0}} |
38 changes: 38 additions & 0 deletions
38
packages/mini-demo/src/pages/checkbox/component/controlled.tsx
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,38 @@ | ||
import React, { useState } from 'react'; | ||
import { showModal } from '@tarojs/taro'; | ||
import { Checkbox, List, Panel } from 'zarm/mini'; | ||
|
||
|
||
const Demo = () => { | ||
const [checked, setChecked] = useState(false); | ||
|
||
const onChange = (e) => { | ||
if (!e.target.checked) { | ||
showModal({ | ||
content: '是否要取消选择', | ||
cancelText: '不取消', | ||
success: ({ confirm }) => { | ||
if (confirm) { | ||
setChecked(false); | ||
} | ||
}, | ||
}); | ||
return false; | ||
} | ||
setChecked(true); | ||
}; | ||
|
||
return ( | ||
<Panel title="取消勾选前确认"> | ||
<List> | ||
<List.Item> | ||
<Checkbox checked={checked} onChange={onChange}> | ||
取消勾选前确认 | ||
</Checkbox> | ||
</List.Item> | ||
</List> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
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 |
---|---|---|
@@ -1,15 +1,19 @@ | ||
|
||
import * as React from 'react'; | ||
import Basic from './component/basic'; | ||
import Buttton from './component/buttton'; | ||
import Controlled from './component/controlled'; | ||
import List from './component/list'; | ||
|
||
import './index.scss'; | ||
|
||
export default () => { | ||
return ( | ||
<> | ||
<Basic /> | ||
<Buttton /> | ||
<Controlled /> | ||
<List /> | ||
</> | ||
); | ||
}; | ||
) | ||
} |
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
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.