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

优化 Action sheet 组件 #795

Merged
merged 2 commits into from
Apr 10, 2017
Merged

优化 Action sheet 组件 #795

merged 2 commits into from
Apr 10, 2017

Conversation

twoer
Copy link
Contributor

@twoer twoer commented Apr 7, 2017

1、便于多个菜单公用一个 method,可以通过 item 内容 判定点击的是哪个 action ;
2、action 回调函数 增加 index 参数。

twoer added 2 commits April 7, 2017 16:49
1、便于多个菜单公用一个 method,可以通过 item 内容 判定点击的是哪个 action 。
1、action 回调函数 增加 index 参数。
@galenyuan
Copy link
Contributor

没什么很明显的意义呀,actions 里是可以放自定义属性的,比如

actions: [
  {
    name: 'test',
    method: callback,
    type: 1
  }
]

function callback(item) {
  const { type } = item
  if (type === 1) cb1()
}

这样就可以了,为什么要在组件上做这件事呢

@twoer
Copy link
Contributor Author

twoer commented Apr 10, 2017

@galenyuan

1、现有 actionsheet 的实现,并没有给 action callback 传递任何参数,所以我在 callback 方法调用时,增加了 item 参数;
2、看过多种或多平台的 actionsheet 实现,在 callback 方法中基本都会传递 index 过去,所以就增加了。

@Leopoldthecoder Leopoldthecoder merged commit 6b8feea into ElemeFE:master Apr 10, 2017
@tansuo1989
Copy link

是否考虑添加个默认的方法去?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants