Uni-appDcloud市场插件来了,实现抽屉功能
1.先上效果看看与您想要的效果是否一样
2.一样的话,那下面我来教你,用ctrl+cv
附上Dcloud插件市场的地址
https://ext.dcloud.net.cn/plugin?id=26
3.导入到编辑器HbuilderX ,不用import 和components 直接用
template部分
<template>
<uni-drawer ref="showLeft" mode="left" :mask-click="false">
<scroll-view class="bg-color-white" style="height: 100%; width:330px;" scroll-y="true">
<div class="padding20">
<view class="marginT120">
</view>
<uni-easyinput prefixIcon="search" type="number" v-model="formData.wkNo"
:inputBorder="true" placeholder="请输入" id="input-ipt" focus />
<!-- <view v-for="item in 60" :key="item">可滚动内容 {{ item }}</view> -->
<view class="box-button marginT50">
<button class="marginR20" @click="closeDrawer" type="default">关闭</button>
<button @click="affirmDrawer" type="primary">确定</button>
</view>
</div>
</scroll-view>
</uni-drawer>
<template>
methods部分
// 点击打开弹窗
showDrawer() {
this.$refs["showLeft"].open();
console.log(3333333)
},
// 关闭
closeDrawer() {
this.$refs["showLeft"].close();
},
// 确认
affirmDrawer() {
var that = this
that.$refs["showLeft"].close();
},
//三个时间showDrawer(点击打开) closeDrawer(关闭事件)affirmDrawer(打开事件)
//可自行根据需要帮定事件实现赋值
综上所述: 就是uniapp实现uni-drawer 抽屉效果的全部过程及源码,(这是H5端的)