Skip to content

消息通知 xMsgNotice


在线预览
在线模拟尺寸:

介绍

本组件可以通过左右拖拉关闭消息,往左拉,左关闭,右拉右关闭,有阻尼回弹效果,可单独设置。

平台兼容

HarmonyH5andriodIOS小程序UTSUNIAPP-X SDKversion
☑️☑️☑️☑️4.76+1.1.18

文件路径

ts

@/uni_modules/tmx-ui/components/x-msg-notice/x-msg-notice.uvue

使用

ts

<x-msg-notice></x-msg-notice>

Props 属性

名称说明类型默认值
modelValue打开和关闭状态
等同v-model,如果使用:modelValue将不受控.
booleantrue
duration动画时间
number300
threshold当滑动时小于此值,会回弹到原位。而不执行关闭
number50
round圆角,空值时取全局的drawr圆角。
string""
position显示位置top,bottom
positionType"bottom"
offset距离边界的偏移量
string"12px"
bgColor背景
string"white"
darkBgColor暗黑的背景,如果不提供,读取sheetDarkColor
string""
clickClose点击组件是否关闭通知
booleantrue

Events 事件

名称参数说明
click-组件点击事件
update:modelValue-等同v-model

Slots 插槽

名称说明数据
default默认插槽-

Ref 方法

名称参数返回值说明

示例文件路径

json

/pages/fankui/msg-notice

示例源码

uvue
vue
<template>
	<!-- #ifdef APP -->
	<scroll-view style="flex:1">
	<!-- #endif -->
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
		
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">也可变量控制</x-text>
			<view class="flex flex-row flex-row-center-between">
				<x-button width="48%" @click="onClick(true)">打开底部消息条</x-button>
				<x-button width="48%" @click="onClick(false)" color="error">关闭询问消息条</x-button>
			</view>
		</x-sheet>
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">消息通知 xMsgNotice</x-text>
			<x-text color="#999999" >
				本组件可以通过左右,上下拖拉关闭消息,往向不同方向拉手势,会向指定方向关闭,有阻尼回弹效果,可单独设置。
			</x-text>
		</x-sheet>
		<x-msg-notice :model-value="true" position="top" round="10">
			<x-sheet color='primary' :margin="['0']" :round="['0']">
				<view class="flex flex-row flex-row-top-between">
					<x-image round="10" width="64" height="64" src="https://store.tmui.design/api/randomImg"></x-image>
					<view class="flex-1 ml-10">
						<x-text color="white" class=" text-weight-b">左右或者向上拉可关闭</x-text>
						<x-text color="white" font-size="12" >本组件可以通过左右,上下拖拉关闭消息</x-text>
					</view>
				</view>
			</x-sheet>
		</x-msg-notice>
		<x-msg-notice v-model="show"  round="10" offset="20">
			<x-sheet :margin="['0']" :round="['0']">
				<x-text class=" text-weight-b">消息通知 xMsgNotice</x-text>
				<x-text font-size="12" class="opacity-6" >本组件可以通过左右,上下拖拉关闭消息,往向不同方向拉手势,会向指定方向关闭,有阻尼回弹效果,可单独设置。</x-text>
			</x-sheet>
		</x-msg-notice>
	<!-- #ifdef APP -->
	</scroll-view>
	<!-- #endif -->
</template>

<script setup lang="ts">
	import { ref } from 'vue'
	
	const show = ref(false)
	
	const onClick = (isshow : boolean) => {
		show.value = isshow;
	}
</script>

<style lang="scss">

</style>
最近更新