ActionSheet 动作面板

从底部弹出的动作菜单面板。

基本用法

默认

  1. <div @click="switchActionSheet">
  2. <span><label>基础用法</label></span>
  3. <div class="selected-option" v-html="state.val"></div>
  4. </div>
  5. <nut-actionsheet
  6. v-model:visible="state.isVisible"
  7. :menu-items="menuItems"
  8. @choose="chooseItem"
  9. ></nut-actionsheet>

展示取消按钮

  1. <div @click="switchActionSheet">
  2. <span><label>展示取消按钮</label></span>
  3. <div class="selected-option" v-html="state.val"></div>
  4. </div>
  5. <nut-actionsheet v-model:visible="isVisible"
  6. @close="switchActionSheet"
  7. :menu-items="menuItems"
  8. @choose="chooseItem"
  9. cancel-txt="取消"
  10. ></nut-actionsheet>

展示描述信息

  1. <div @click.native="switchActionSheet">
  2. <span><label>展示取消按钮</label></span>
  3. <div class="selected-option" v-html="state.val"></div>
  4. </div>
  5. <nut-actionsheet v-model:visible="isVisible"
  6. @close="switchActionSheet"
  7. description="state.desc"
  8. :menu-items="menuItems"
  9. @choose="chooseItem"
  10. cancel-txt="取消"
  11. ></nut-actionsheet>

选项状态

  1. <div @click.native="switchActionSheet">
  2. <span class="title"><label>性别</label></span>
  3. <span class="selected-option" v-html="sex"></span>
  4. </div>
  5. <nut-actionsheet
  6. @close="switchActionSheet"
  7. v-model:visible="state.isVisible4"
  8. cancel-txt="取消"
  9. :menu-items="menuItemsThree"
  10. ></nut-actionsheet>
  1. setup() {
  2. const state = reactive({
  3. isVisible: false,
  4. value: '',
  5. desc: '这是一段描述信息'
  6. });
  7. const menuItems = [
  8. {
  9. name: '选项一',
  10. value: 0
  11. },
  12. {
  13. name: '选项二',
  14. value: 1
  15. },
  16. {
  17. name: '选项三',
  18. value: 2
  19. }
  20. ];
  21. const switchActionSheet = () => {
  22. state.isVisible = !state.isVisible
  23. };
  24. const chooseItem = (item,index) => {
  25. console.log(item,index);
  26. };

Prop

字段说明类型默认值
cancel-txt取消文案String‘取消’
menu-items列表项Array[ ]
option-tag设置列表项展示使用参数String‘name’
v-model:visible遮罩层可见Booleanfalse
option-sub-tag设置列表项描述展示使用参数String‘subname’
choose-tag-value设置选中项的值,和’option-tag’的值对应String‘’
title设置列表项标题String‘’
description设置列表项副标题/描述String‘’
color高亮颜色String‘#ee0a24’
close-abled遮罩层是否可关闭Booleantrue

Event

字段说明回调参数
choose选择之后触发选中列表项item, 选中的索引值index
cancel点击取消文案时触发

ActionSheet  动作面板 - 图1