@cainiaofe/cn-ui-m
Version:
71 lines (70 loc) • 3.05 kB
JavaScript
import React, { useMemo, useRef } from 'react';
import { CnCard, CnCardItems, CnDemoPage, CnIcon } from "../../..";
export var 二级卡片模式 = function () {
var ref = useRef(null);
var operateColumn = useMemo(function () { return ({
buttons: [
{
children: '编辑',
onClick: function (event, record, index) {
var _a;
console.log('编辑', event, record, index);
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.refreshAsync();
},
},
{
children: '详情',
onClick: function (event, record, index) {
var _a;
console.log('详情', event, record, index);
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.currentPageRefreshAsync();
},
},
],
}); }, []);
return (React.createElement(CnDemoPage, null,
React.createElement(CnCard, { title: "\u57FA\u7840\u4FE1\u606F" },
React.createElement(CnCardItems, { entryTitle: "\u8BE6\u60C5", ref: ref, primaryKey: "id", icon: function () { return ({
type: 'add',
}); }, subIcon: function () { return ({
type: 'add',
}); }, subTitle: function () { return '内标题'; }, subDesc: function () { return '内标题说明'; }, subAction: function () { return React.createElement(CnIcon, { type: "forward1" }); }, tags: function () { return [
{
status: 'success',
text: '成功',
},
{
status: 'warning',
text: '警告',
},
{
status: 'error',
text: '失败',
},
]; }, operateColumn: operateColumn, requestConfig: {
url: 'https://mocks.alibaba-inc.com/mock/cnui-api-demo/cardsOpt',
}, showSelect: true, onSelectChange: function (a, b) {
console.log('onSelectChange', a, b);
}, toolbar: {
buttons: [
{
children: '关注',
onClick: console.log,
},
{
children: '喜欢',
onClick: console.log,
},
{
children: '更新',
onClick: console.log,
},
{
children: '新增',
type: 'primary',
onClick: console.log,
},
],
} }))));
};
export default { title: 'demo/CnCardItems' };