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

数据库对于做网站的重要性百度手机助手应用商店

数据库对于做网站的重要性,百度手机助手应用商店,电子商务网站营销的方法,阿里云 香港 网站最近忙于开发抖音小程序,最想吐槽的就是,既没有适配的UI框架,百度上还找不到关于抖音小程序的案列,我真的很裂开啊,于是我通过大模型封装了一套代码 效果如下 介绍 可以看到 这个弹出层是支持关闭和标题显示的&#xf…

最近忙于开发抖音小程序,最想吐槽的就是,既没有适配的UI框架,百度上还找不到关于抖音小程序的案列,我真的很裂开啊,于是我通过大模型封装了一套代码

效果如下

在这里插入图片描述

介绍

可以看到 这个弹出层是支持关闭和标题显示的,同时这个出场肯定是从下到上的,当然它肯定是支持任意方向弹出的 效果类似于element ui 的抽屉效果

代码

在 components 新建组件 drawer

抽屉的结构部分

<!-- drawer.wxml -->
<view class="drawer-container" tt:if="{{isVisible}}"><view class="drawer-mask" style="{{maskStyle}}" bindtap="onMaskClick" tt:if="{{mask}}"></view><view class="drawer-content" style="{{drawerStyle}}" catchtouchmove="stopPropagation"><!-- 头部区域 --><view class="drawer-header" tt:if="{{showTitle || showClose}}"><text class="drawer-title" tt:if="{{showTitle && title}}">{{title}}</text><view class="header-spacer" tt:if="{{!title && showClose}}"></view><view class="drawer-close-btn" tt:if="{{showClose}}" bindtap="onCloseClick"><text class="close-icon">×</text></view></view><!-- 内容区域 --><view class="drawer-body"><slot></slot></view></view></drawer-container>

抽屉逻辑处理部分

// drawer.js
Component({properties: {show: {type: Boolean,value: false,observer: 'toggleDrawer'},direction: {type: String,value: 'bottom', // left, right, top, bottomobserver: 'updatePosition'},width: {type: String,value: '100%'},height: {type: String,// value: '100%'},mask: {type: Boolean,value: true},maskClosable: {type: Boolean,value: true},showClose: {type: Boolean,value: true},title: {type: String,value: ''},showTitle: {type: Boolean,value: true},duration: {type: Number,value: 300}},data: {drawerStyle: '',maskStyle: '',isVisible: false,isTransitioning: false},methods: {toggleDrawer(newVal) {if (newVal) {this.openDrawer();} else {this.closeDrawer();}},updatePosition() {if (!this.data.isVisible) {this.setInitialPosition();}},setInitialPosition() {const { direction, width, height } = this.properties;let style = `position: fixed; z-index: 10000;`;switch(direction) {case 'left':style += `width: ${width}; height: ${height}; top: 0; left: 0; transform: translateX(-100%);`;break;case 'right':style += `width: ${width}; height: ${height}; top: 0; right: 0; transform: translateX(100%);`;break;case 'top':style += `width: ${width}; height: ${height}; top: 0; left: 0; transform: translateY(-100%);`;break;case 'bottom':style += `width: ${width}; height: ${height}; bottom: 0; left: 0; transform: translateY(100%);`;break;}this.setData({drawerStyle: style});},openDrawer() {if (this.data.isVisible || this.data.isTransitioning) return;const { direction, duration } = this.properties;// 先设置初始位置并显示this.setInitialPosition();this.setData({isVisible: true,maskStyle: 'opacity: 0;'});// 强制重排后应用动画setTimeout(() => {let drawerStyle = this.data.drawerStyle;const transformProp = direction.includes('left') || direction.includes('right') ? 'translateX' : 'translateY';drawerStyle = drawerStyle.replace(`${transformProp}(-100%)`, `${transformProp}(0)`);drawerStyle = drawerStyle.replace(`${transformProp}(100%)`, `${transformProp}(0)`);drawerStyle += `transition: transform ${duration}ms cubic-bezier(0.25, 0.8, 0.25, 1);`;this.setData({drawerStyle,maskStyle: `opacity: 0.7; transition: opacity ${duration}ms cubic-bezier(0.25, 0.8, 0.25, 1);`});this.data.isTransitioning = true;setTimeout(() => {this.data.isTransitioning = false;this.triggerEvent('open');}, duration);}, 10);},closeDrawer() {if (!this.data.isVisible || this.data.isTransitioning) return;const { direction, duration } = this.properties;let drawerStyle = this.data.drawerStyle;const transformProp = direction.includes('left') || direction.includes('right') ? 'translateX' : 'translateY';// 添加关闭动画drawerStyle = drawerStyle.replace(`${transformProp}(0)`, `${transformProp}(${direction.includes('left') || direction.includes('top') ? '-100%' : '100%'})`);drawerStyle += `transition: transform ${duration}ms cubic-bezier(0.25, 0.8, 0.25, 1);`;this.setData({drawerStyle,maskStyle: `opacity: 0; transition: opacity ${duration}ms cubic-bezier(0.25, 0.8, 0.25, 1);`});this.data.isTransitioning = true;// 动画结束后隐藏setTimeout(() => {this.setData({isVisible: false});this.data.isTransitioning = false;this.triggerEvent('close');}, duration);},onMaskClick() {if (this.properties.maskClosable && !this.data.isTransitioning) {this.closeDrawer();}},onCloseClick() {if (!this.data.isTransitioning) {this.closeDrawer();}},stopPropagation() {}},attached() {this.setInitialPosition();}
});

抽屉的基本样式

/* drawer.wxss */
.drawer-container {position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 9999;
}.drawer-mask {position: absolute;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.6);backdrop-filter: blur(2px);
}.drawer-content {position: fixed;background-color: #fff;box-shadow: -2px 0 15px rgba(0, 0, 0, 0.1);overflow: hidden;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;-webkit-overflow-scrolling: touch;
}/* 右侧抽屉的阴影 */
.drawer-content[style*="right: 0"] {box-shadow: -2px 0 15px rgba(0, 0, 0, 0.1);
}/* 左侧抽屉的阴影 */
.drawer-content[style*="left: 0"][style*="width"] {box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
}/* 顶部抽屉的阴影 */
.drawer-content[style*="top: 0"][style*="height"] {box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}/* 底部抽屉的阴影 */
.drawer-content[style*="bottom: 0"][style*="height"] {box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.1);
}.drawer-title {font-size: 32rpx;font-weight: 500;color: #333;
}.drawer-close-btn:hover {background-color: rgba(0, 0, 0, 0.1);
}.close-icon {font-size: 36rpx;color: #333;
}/* 内容区域 */
.drawer-body {height: calc(100% - 100rpx);/* 减去头部高度 */overflow-y: auto;padding: 40rpx;box-sizing: border-box;
}/* drawer.wxss 新增样式 */
.drawer-header {position: relative;padding: 30rpx 40rpx;min-height: 100rpx;box-sizing: border-box;display: flex;align-items: center;justify-content: space-between;border-bottom: 1rpx solid #eee;
}.header-spacer {flex-grow: 1;
}.drawer-close-btn {position: absolute;top: 30rpx;right: 40rpx;width: 48rpx;height: 48rpx;border-radius: 50%;background-color: rgba(0, 0, 0, 0.05);display: flex;align-items: center;justify-content: center;transition: background-color 0.2s;z-index: 10;
}

对应文件的json引入使用

{"navigationBarTitleText": "商品详情","usingComponents": {"Drawer": "/components/Drawer/Drawer"},"allowsBounceVertical": "NO"
}

界面部分


<Drawer show="{{dateShow}}" showTitle="{{true}}" showClose="{{true}}" title="账单详情" class="detail-popup" bind:close="handlePopupClose"><view class="repayment-popup"><view class="repayment-popup-item"><text>账期</text><text>第{{repaymentTime.periods}}期</text></view><view class="repayment-popup-item"><text>账单日</text><text>{{util.formatDateToDay(repaymentTime.date)}}</text></view><view class="repayment-popup-item"><text>账单总额</text><text>{{util.moneyFormatMinZero(repaymentTime.waitPay)}}</text></view><view class="repayment-popup-item"><text>待还本金</text><text>{{util.moneyFormatMinZero(repaymentTime.waitPrincipalMoney)}}</text></view><view class="repayment-popup-item"><text>待还滞纳金</text><text>{{util.moneyFormatMinZero(repaymentTime.waitOverdueMoney)}}</text></view></view>
</Drawer>

界面逻辑部分

const app = getApp();
Page({data: {dateShow: false,},appreciationEvent() {this.setData({dateShow: true,});},handlePopupClose() {this.setData({dateShow: false});}

完结啦 🎉 🎉 🎉

http://www.dtcms.com/wzjs/179118.html

相关文章:

  • 合肥专业商业网站软文网站模板
  • 做阿里网站需要的faq云服务器
  • 制作网站是什么专业上海网站优化
  • web前端网站模板株洲网站设计
  • 邹平 建设项目 网站公示百度站长资源
  • 巴中市建设局新网站淘宝补流量平台
  • 和小男生做的网站优化大师有必要安装吗
  • 假冒建设银行网站北京网优化seo优化公司
  • 广州市住房与城乡建设部网站查域名
  • SEO网站建设全方位部署企业网站设计服务
  • 服装辅料东莞网站建设做网站需要多少钱
  • 绵阳最有实力的公司网站建设如何做好网站站内优化
  • 开发游戏用什么编程软件seo营销名词解释
  • 网站在别人那里已经建好了_公司里要进行修改_怎么做谷歌搜索引擎google
  • 青岛公司做网站百度怎么做推广和宣传
  • 模板网建站品牌广告视频
  • 网站备案弊端商业软文怎么写
  • asp.net创建项目和创建网站的区别百度产品优化排名软件
  • 网站诊断博客网址导航怎样推广
  • 购物网站开发什么是网站开发百度竞价排名名词解释
  • 东莞网站建设 信科网络广告文案
  • 产品介绍网站模板360推广
  • 哪些网站是discuz做郑州网络推广代理顾问
  • 网站建设 手机和pc种子资源地址
  • 网站下载不了的视频怎么下载朋友圈广告推广代理
  • 网站建设公司不赚钱百度代理公司查询
  • 一个网站的建设需要什么推广产品的方法和步骤
  • 生活中好的设计产品什么是淘宝seo
  • 全网万能搜索引擎前端seo怎么优化
  • 南通网站建设系统方案长沙正规seo优化价格