Skip to content

引入组件

局部引入

ts
// parent.vue
const FActionSheet = defineAsyncComponent(() => import('@/components/formaui/f-action-sheet/f-action-sheet.vue'))

基础用法

html
<f-action-sheet v-model="showActionSheet" :items="items" @item-click="clickItem"></f-action-sheet>
<f-button width="200rpx" margin="200rpx auto" @click="showActionSheet = true">click</f-button>
ts
import { ref } from 'vue'
const showActionSheet = ref<boolean>(false)
const items = ref([
  { label: '选项1', value: 1, disabled: true },
  { label: '选项2', value: 2 },
  { label: '选项3', value: 3 }
])
const clickItem = (value: string | number) => {
  uni.showToast({ title: value.toString(), icon: 'none' })
}

插槽

名称说明
header头部显示内容

属性

名称类型说明默认值
items{label:string;
value:string/number;
color?:string;
disabled?:boolean}[]
列表项[]
isMaskboolean是否显示遮罩层true
closeOnClickMaskboolean是否点击遮罩层关闭键盘true
borderRadiusstring自定义圆角大小16rpx
fontSizestring自定义字体大小32rpx
textColorstring自定义字体颜色#0B1D4A
isCancelboolean是否展示取消按钮true
cancelTextstring自定义取消按钮文字取消
cancelColorstring自定义取消按钮字体颜色#0B1D4A
cancelBgColorstring自定义取消按钮背景颜色#E7E6EB
bgColorstring自定义键盘背景颜色#FFFFFF

事件

事件名说明回调参数
itemClick点击actionsheet上的cell时触发cell绑定的值

方法

方法名说明传入参数
---