Skip to content

动作菜单面板 xActionMenu


在线预览
在线模拟尺寸:

介绍

从底部弹出来的操作菜单。

平台兼容

H5andriodIOS小程序UTSUNIAPP-X SDKversion
☑️☑️☑️☑️4.44+1.1.9

文件路径

ts

@/uni_modules/tmx-ui/components/x-action-menu/x-action-menu.uvue

使用

ts

<x-action-menu></x-action-menu>

Props 属性

名称说明类型默认值
customStyle自定义遮罩样式string""
title标题,请选择string""
showTitle是否显示标题booleantrue
showClose是否显示关闭booleanfalse
overlayClick遮罩是否允许点击被关闭booleantrue
cellClickClose选项点击时,是否允许关闭弹层。booleantrue
show显示可v-model:show双向绑定booleanfalse
showCancel显示取消按钮booleantrue
duration动画时间number350
round打开方向为上和下时的圆角<br>空值时,取全局配置的圆角。注意是取drawer的圆角,统一弹层的圆角string""
maxHeight弹层最大的高度值,默认为屏幕的可视高<br>提供值时不能为百分比,可以是px,rpx单位数字。如果你不带单位,默认转换为rpx单位。string""
list菜单条目XACTION_MENU_ITEM_INFO[]() : XACTION_MENU_ITEM_INFO[] => [] as XACTION_MENU_ITEM_INFO[]
space弹层的层,两边是否留空白间隙,包括底部。booleantrue
watiDuration打开dom的延迟量,如果你打开 弹窗在ios正常。<br>请不要修改此值。如果遇到打不开,或者 打开 后没动画,关闭不了等可能是sdk bug导致 <br>此时需要加大值来避免。具体加多少以你弹窗内的节点复杂度有关,需要你自行压力测试。<br>此值仅在ios下生效。number120

Events 事件

名称参数说明
cancel-取消时触发
click-点击遮罩事件
close-关闭时执行
open-打开执行的事件
beforeOpen-打开前执行
beforeClose-关闭前执行
update:show-等同v-model:show
item-click**index** : number项目被点击。由于安卓端动画关闭前触发,会触发view渲染异常.导致动画失败.从而造成,下个页面返回时,上页无法执行结束.

Slots 插槽

名称说明数据
trigger标签触发显示遮罩,免于使用变量控制show : Boolean
title标题插槽show : Boolean
default默认插槽-

Ref 方法

名称参数返回值说明

示例文件路径

json

/pages/fankui/action-menu

示例源码

uvue
vue
<template>
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
	<view>
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">动作菜单 ActionMenu</x-text>
			<x-text color="#999999" >
				从底部弹出的菜单选项,自由度高。
			</x-text>
		</x-sheet>
		<x-sheet>
			<x-action-menu @item-click="itemclick" @cancel="oncancel" :list="list2" title="测试菜单">
				<template #trigger>
					<x-button :block="true">默认</x-button>
				</template>
			</x-action-menu>
		</x-sheet>
		<x-sheet>
			<x-action-menu :list="list">
				<template #trigger>
					<x-button :block="true">可以定义颜色显示</x-button>
				</template>
			</x-action-menu>
		</x-sheet>
	</view>
</template>

<script>
	import { XACTION_MENU_ITEM_INFO } from "@/uni_modules/tmx-ui/interface.uts"
	import { xStore } from "@/uni_modules/tmx-ui/index.uts"
	export default {
		data() {
			return {
		
				list:[
					{
						icon:"notification-line",
						text:"通知栏",
						id:"1"
					} as XACTION_MENU_ITEM_INFO,
					{
						icon:"notification-line",
						text:"我被禁用",
						id:"2",
						disabled:true
					} as XACTION_MENU_ITEM_INFO,
					{
						icon:"notification-line",
						text:"我修改了颜色",
						id:"3",
						iconColor:'red',
						fontColor:'red'
					} as XACTION_MENU_ITEM_INFO,
					{
						text:"我没有图标",
						id:"4"
					} as XACTION_MENU_ITEM_INFO
				] as XACTION_MENU_ITEM_INFO[],
				list2:[
					{
						text:"我是菜单栏",
						id:"1"
					} as XACTION_MENU_ITEM_INFO,
					{
						text:"我是菜单栏",
						id:"2",
					} as XACTION_MENU_ITEM_INFO,
					{
						text:"我是菜单栏",
						id:"3",
					} as XACTION_MENU_ITEM_INFO
				] as XACTION_MENU_ITEM_INFO[]
			};
		},
		onLoad(){
		},
		methods:{
			itemclick(index:number){
				console.log(index)
			},
			oncancel(){
				console.log(4)
			}
		}
	}
</script>

<style lang="scss">

</style>
最近更新