Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(demo): display 'bound dispatchSetState' message in demo8 of table demos #2626

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/packages/table/demos/h5/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,8 @@ import React, { useState } from 'react'
import { Table } from '@nutui/nutui-react'

const Demo8 = () => {
const data1 = useState<Array<any>>([
{
name: 'Tom',
gender: '男',
record: '小学',
},
{
name: 'Lucy',
gender: '女',
record: '本科',
},
{
name: 'Jack',
gender: '男',
record: '高中',
},
])
const [data, setData] = useState<Array<any>>([])
const [columns1] = useState([
const columns = [
{
title: '姓名',
key: 'name',
Expand All @@ -40,11 +23,28 @@ const Demo8 = () => {
title: '学历',
key: 'record',
},
])
]
const data1 = [
{
name: 'Tom',
gender: '男',
record: '小学',
},
{
name: 'Lucy',
gender: '女',
record: '本科',
},
{
name: 'Jack',
gender: '男',
record: '高中',
},
]
setTimeout(() => {
setData(data1)
}, 5000)

return <Table columns={columns1} data={data} style={{ background: '#fff' }} />
return <Table columns={columns} data={data} style={{ background: '#fff' }} />
}
export default Demo8
44 changes: 22 additions & 22 deletions src/packages/table/demos/taro/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,19 @@ import React, { useState } from 'react'
import { Table } from '@nutui/nutui-react-taro'

const Demo8 = () => {
const [data1] = useState<Array<any>>([
{
name: 'Tom',
sex: '男',
record: '小学',
},
{
name: 'Lucy',
sex: '女',
record: '本科',
},
{
name: 'Jack',
sex: '男',
record: '高中',
},
])
const [data, setData] = useState<Array<any>>([])
const [columns] = useState([
const columns = [
{
title: '姓名',
key: 'name',
},
{
title: '性别',
key: 'sex',
key: 'gender',
render: (record: any) => {
return (
<span style={{ color: record.sex === '女' ? 'blue' : 'green' }}>
{record.sex}
<span style={{ color: record.gender === '女' ? 'blue' : 'green' }}>
{record.gender}
</span>
)
},
Expand All @@ -40,7 +23,24 @@ const Demo8 = () => {
title: '学历',
key: 'record',
},
])
]
const data1 = [
{
name: 'Tom',
gender: '男',
record: '小学',
},
{
name: 'Lucy',
gender: '女',
record: '本科',
},
{
name: 'Jack',
gender: '男',
record: '高中',
},
]
setTimeout(() => {
setData(data1)
}, 5000)
Expand Down
Loading