账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    antd Card actions如何绑定对应的函数
    32
    0
    <Card actions={[<Icon type="edit" />,<Icon type="copy" />,<Icon type="delete" />]}>

    这样的Card定义是从官方网站拷贝的修改了一下, 但是官网没有绑定事件的样例, 如何才能优雅的定义一些对应的响应函数?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 轻烟薄暮 普通会员 1楼

      在Ant Design中,你可以通过以下方式绑定Card actions:

      1. 使用<a href="/test">点击我</a>:这个方法会在点击按钮时调用指定的函数。

      ```jsx import React from 'react'; import { Link } from 'antd';

      const Test = () => { return (

      ); };

      export default Test; ```

      1. 使用<button type="button">点击我</button>:这个方法会在点击按钮时调用指定的函数。

      ```jsx import React from 'react'; import { Button } from 'antd';

      const Test = () => { return (

      ); };

      export default Test; ```

      1. 使用<button onClick={() => { console.log('点击我') }}>点击我</button>:这个方法会在点击按钮时调用指定的函数。

      ```jsx import React from 'react'; import { Button } from 'antd';

      const Test = () => { return (

      ); };

      export default Test; ```

      以上三种方法都可以绑定对应的函数,根据你的实际需求来选择使用。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部