当前位置: 首页 > news >正文

uniapp uni-drawer组件vue3写法

uniapp uni-drawer组件vue3用法

官方vue2版本

<template>
	<view>
		<button @click="showDrawer" type="primary">右侧弹出 显示Drawer</button>
		<uni-drawer ref="showRight" mode="right" :mask-click="false">
			<scroll-view style="height: 100%;" scroll-y="true">
				<button @click="closeDrawer" type="primary">关闭Drawer</button>
				<view v-for="item in 60" :key="item">可滚动内容 {{ item }}</view>
			</scroll-view>
		</uni-drawer>
	</view>
</template>

<script>
	export default {
		methods: {
			showDrawer() {
				this.$refs.showRight.open();
			},
			closeDrawer() {
				this.$refs.showRight.close();
			}

		}
	}
</script>

VUE3版本改写

<template>
	<view>
		<button @click="showDrawer" type="primary">右侧弹出 显示Drawer</button>
		<uni-drawer ref="showRight" mode="right" :mask-click="false">
			<scroll-view style="height: 100%;" scroll-y="true">
				<button @click="closeDrawer" type="primary">关闭Drawer</button>
				<view v-for="item in 60" :key="item">可滚动内容 {{ item }}</view>
			</scroll-view>
		</uni-drawer>
	</view>
</template>

<script setup>
import { ref } from 'vue'
const showRight=ref(false)

	showDrawer() {
		showRight.value.open();
	},
	closeDrawer() {
		showRight.vlaue.close();
	}

</script>

文章转载自:
http://angara.jopebe.cn
http://aborted.jopebe.cn
http://anemometer.jopebe.cn
http://bodhidharma.jopebe.cn
http://areopagy.jopebe.cn
http://casuist.jopebe.cn
http://captivate.jopebe.cn
http://chafferer.jopebe.cn
http://altricial.jopebe.cn
http://aah.jopebe.cn
http://arose.jopebe.cn
http://canalize.jopebe.cn
http://antarthritic.jopebe.cn
http://abyssinian.jopebe.cn
http://chatellany.jopebe.cn
http://beau.jopebe.cn
http://avgas.jopebe.cn
http://adcolumn.jopebe.cn
http://biographize.jopebe.cn
http://amphitheatre.jopebe.cn
http://brooch.jopebe.cn
http://aftertreatment.jopebe.cn
http://ashlaring.jopebe.cn
http://brio.jopebe.cn
http://amdg.jopebe.cn
http://bernard.jopebe.cn
http://apostatize.jopebe.cn
http://belgrade.jopebe.cn
http://azion.jopebe.cn
http://cautioner.jopebe.cn
http://www.dtcms.com/a/87286.html

相关文章:

  • 【C++经典例题】寻找字符串中第一个不重复字符的索引
  • C++STL(四):stack和queue的模拟实现
  • [python] 使用Python实现Markdown文档格式转换
  • Flutter 输入组件 Radio 详解
  • 2018扬州大学876农业机械学概论填空名词解释简答
  • 文件I/O--C++的文件操作
  • 风电资源评估的关键指标及其应用
  • Log4j2 的核心实现和源码分析
  • 电源滤波器在医用电气设备中的应用
  • HTML5 canvas圆形泡泡动画背景特效
  • 【Arm+Qt+Opencv】基于人脸识别考勤系统实战
  • Android系统深度定制:内置Google TTS语音引擎并设为默认的终极指南
  • 【Git】基础使用
  • 国际机构Gartner发布2025年网络安全趋势
  • GaussDB数据库表设计与性能优化实践
  • [特殊字符] C++ 常见 Socket 错误与优化指南
  • [深度学习]特征提取和无监督
  • 如何让机器像人类一样感知声调颤抖与嘴角抽动的同步情感表达?
  • 如何确保异步任务在 HTTP 返回后继续执行?context.WithoutCancel
  • 常见框架漏洞之五:中间件
  • 操作系统必知的面试题
  • 【STM32】初识STM32
  • Spring MVC请求与响应全解析:从参数绑定到异常处理
  • 蓝桥杯历届真题 填充#贪心算法
  • 什么是索引?为什么要使用B树作为索引数据结构?
  • C++11 标准库 `find` 与 `find_if` 详解
  • 基于Spring Boot的三国之家网站的设计与实现(LW+源码+讲解)
  • 学一个前端 UI 框架,要学些什么内容?
  • 使用ThreadLocal可能导致内存泄漏的原因与其底层实现机制
  • 干货!Kubernetes网络模型与访问管理