动作面板 ActionSheet

基本用法

动作面板 Actionsheet - 图1

  1. <template lang="html">
  2. <main>
  3. <div class="demo-hidden">
  4. <za-panel>
  5. <za-panel-header title="基本">
  6. </za-panel-header>
  7. <za-panel-body>
  8. <za-cell>
  9. <za-button size="xs" slot='description' @click='visible1 = true'>开启</za-button>
  10. 普通
  11. </za-cell>
  12. <za-cell>
  13. <za-button size="xs" slot='description' @click='visible2 = true'>开启</za-button>
  14. 带取消操作
  15. </za-cell>
  16. </za-panel-body>
  17. </za-panel>
  18. </div>
  19. <za-actionsheet :visible.sync='visible1' :actions='actions2' :show-cancel='false'></za-actionsheet>
  20. <za-actionsheet :visible.sync='visible2' :actions='actions1' @cancel='cancelCb'></za-actionsheet>
  21. </main>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. visible1: false,
  28. visible2: false,
  29. actions1: [{
  30. text: '操作一',
  31. onClick: () => console.log('action 1'),
  32. },{
  33. text: '操作二',
  34. onClick: () => console.log('action 2'),
  35. },{
  36. theme: 'error',
  37. text: '操作三',
  38. onClick: () => console.log('action 3'),
  39. }],
  40. actions2: [{
  41. text: '操作一',
  42. onClick: () => console.log('action 1'),
  43. },{
  44. text: '操作二',
  45. onClick: () => console.log('action 2'),
  46. }],
  47. }
  48. },
  49. methods: {
  50. cancelCb(reason, event){
  51. console.log(reason, event)
  52. }
  53. },
  54. };
  55. </script>

API

ActionSheet Attributes

属性类型默认值可选值/参数说明
prefixClsstringza-switch类名前缀
shapestring''形状 ,可选radius
spacingboolfalse是否留边
visibleboolfalse是否显示, 支持.sync 修饰符 (v2.3.0+)
actionsarrayOf(object)[ ]object: { theme, text, onClick }动作列表
cancelTextstring'取消'取消菜单的文案

ActionSheet Events

事件名称说明回调参数
cancel当actionsheet关闭时触发的事件。当点击actionButton关闭时第一个参数为'action',当点击popup关闭时第一个参数为'clickaway'1. reason, 2. event 事件对象