提交 1a7e4071 authored 作者: 钟是志's avatar 钟是志

29127 违纪,H5应用增加卡片组件

上级 a99dd598
......@@ -8,16 +8,19 @@ export default function MobileCard(props) {
otherProps = json?.otherProps;
try {
let arg = {};
if(typeof getArguments === 'function'){
arg = getArguments({base52: dataColumn.base52}, function() {});
if (typeof getArguments === 'function') {
arg = getArguments({ base52: dataColumn.base52 }, function() {});
}
otherProps = new Function('functionArguments', 'tableComProps', otherProps)(arg, tableComProps);
otherProps = new Function('functionArguments', 'tableComProps', otherProps)(
arg,
tableComProps,
);
} catch (e) {
console.log('MobileCard组件获取otherProps 报错', e);
otherProps = null;
}
}
if(!otherProps){
if (!otherProps) {
return null;
}
const dataSource = value?.dataSource || otherProps?.defaultDataSource || [];
......@@ -25,18 +28,42 @@ export default function MobileCard(props) {
return (
<>
{dataSource.map((g, index) => {
// const clickFunction = // 点击整个块
// typeof g.handleClick === 'function'
// ? e => {
// if (e && e.stopPropagation) {
// e.stopPropagation();
// e.preventDefault();
// }
// return g.handleClick(g, value);
// }
// : undefined;
return (
<div key={g[primaryKey]} style={style}>
<WingBlank>
{columns.map((c, cIndex) => {
const { style: cStyle, data: cData } = c;
const clickFunction = // 点击某一行
typeof c.handleClick === 'function'
? e => {
if (e && e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
return c.handleClick(g, c, value);
}
: undefined;
return (
<div key={c.key} style={cStyle || {}}>
<div key={c.key} style={cStyle || {}} onClick={clickFunction}>
{cData.map((h, hIndex) => {
let hProps = h.props || {};
const clickFunction =
const clickFunction = // 点击某一个单元格
typeof hProps.handleClick === 'function'
? () => {
? e => {
if (e && e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
return hProps.handleClick(g, h.key || h, value);
}
: undefined;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论