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

毕业设计 建设网站免费公司取名器

毕业设计 建设网站,免费公司取名器,网站模板怎么引用,就业网站建设总结目录 前言: 正文: 前言:横屏的尺寸问题 最近使用了uniapp写了一个横屏的微信小程序和H5的项目,也是本人首次写的横屏项目,多少是有点踩坑不太适应。。。 先说最让我一脸懵的点,尺寸大小,下面一…

目录

前言:

正文:


前言:横屏的尺寸问题

        最近使用了uniapp写了一个横屏的微信小程序和H5的项目,也是本人首次写的横屏项目,多少是有点踩坑+不太适应。。。

先说最让我一脸懵的点,尺寸大小,下面一段代码,设置文字的大小伟24rpx;横屏,竖屏下的效果如图

<view class="text" style="font-size: 24rpx">Jay丶萧邦</view>

可以很直观的看出来,横竖屏之间的尺寸差异是蛮大的,大概相差2倍的样子,所以要是业务设计要求可以旋转屏幕的话,得做适配工作,这里就不再多说;

正文:直接附上源码,不多说

言归正传,因为我看UI库好像都不太满足横屏的项目,所以有很多的东西都需要自己手撕一个,弹出框就是其一,先看效果哈:

uniapp横屏弹出框

如果觉得还比较符合您的需求,拿来整改整改即可,直接上代码:

<template><view class="dialog-overlay" v-if="visible" :style="{ zIndex: zIndex }" @tap="closeMask"><view class="dialog" v-if="dialogVisible" :style="[getStyle]" :class="[showAnimate ? 'bounce-enter-active' : 'bounce-leave-active']" @tap.stop><view class="close" v-if="showClose" @tap="close"><view class="iconfont icon-guanbi"></view></view><slot></slot></view></view>
</template><script>
export default {name: 'CustomDialog',props: {visible: {type: Boolean,default: false},width: {type: String,default: 'auto'},height: {type: String,default: 'auto'},radius: {type: String,default: '16rpx'},bgColor: {type: String,default: '#fff'},customStyle: {type: Object,default: () => ({})},/* 是否展示右上角关闭按钮 */showClose: {type: Boolean,default: true},/* 是否点击遮罩层可以关闭弹出框 */maskCloseAble: {type: Boolean,default: true},/* 弹出框层级 */zIndex: {type: Number,default: 999}},data() {return {dialogVisible: this.visible,showAnimate: this.visible,timer: null};},beforeDestroy() {this.clearTimeout();},watch: {visible: {handler(val) {setTimeout(() => {this.dialogVisible = val;this.showAnimate = val;}, 50);},immediate: true}},computed: {getStyle() {return {width: this.width,height: this.height,background: this.bgColor,borderRadius: this.radius,...this.customStyle};}},methods: {clearTimeout() {if (this.timer) {clearTimeout(this.timer);this.timer = null;}},closeMask() {if (!this.maskCloseAble) return;this.close();},close() {this.closeAnimate();this.timer = setTimeout(() => {this.$emit('close');this.$emit('update:visible', false);}, 500);},closeAnimate() {this.showAnimate = false;this.clearTimeout();}}
};
</script><style lang="scss" scoped>
.dialog-overlay {position: fixed;top: 0;left: 0;right: 0;bottom: 0;display: flex;align-items: center;justify-content: center;background-color: rgba(#000, 0.3);
}.dialog {position: relative;border-radius: 16px;padding: 20rpx;padding-bottom: 14rpx;margin-left: -50rpx;opacity: 0;.close {position: absolute;width: 28rpx;height: 28rpx;border-radius: 50%;background-color: rgba(#000, 0.6);top: -10rpx;right: -10rpx;.icon {width: 10rpx;height: 10rpx;}}
}/*  打开与关闭的类名 */
.bounce-enter-active {animation: bounceIn 0.5s both;
}
.bounce-leave-active {animation: bounceOut 0.5s both;
}/* 定义bounceIn动画 */
@keyframes bounceIn {0% {opacity: 0;transform: scale(0);}50% {opacity: 1;transform: scale(1.2);}70% {opacity: 1;transform: scale(0.9);}100% {opacity: 1;transform: scale(1);}
}
/* 定义 bounceOut 动画 */
@keyframes bounceOut {0% {opacity: 1;transform: scale(1);}25% {opacity: 1;transform: scale(0.95);}50% {opacity: 0;transform: scale(1.1);}100% {opacity: 0;transform: scale(0);}
}.icon-guanbi {color: #94ffd8;font-size: 16rpx;
}
</style>

使用:

<template><view class="index"><button @click="visible = true">click</button><custom-dialog :visible.sync="visible" width="500rpx" height="240rpx" @close="close"><view class="content">hello,hello</view></custom-dialog></view>
</template><script>
import CustomDialog from '@/components/CustomDialog/index.vue';
export default {components: {CustomDialog},data() {return {visible: false};},methods: {close() {console.log('我可以做点什么');}}
};
</script><style lang="scss" scoped>
.index {width: 100vw;height: 100vh;display: flex;align-items: center;justify-content: center;
}
</style>

 若是想根据内容大小来撑开宽度高度的话,那就不用设置width 和 height;

喜欢的可以用了!

 

http://www.yayakq.cn/news/47481/

相关文章:

  • 南宁信息建设网站asp.net 制作网站开发
  • 网站建设申请报告html网页制作参考文献
  • 为什么谷歌网站打不开万网的网站怎么建设
  • 做企业网站收费河源北京网站建设
  • 企业信息查询网官网太原seo计费管理
  • 常州市新北区建设与管理局网站网页游戏排行2013
  • 高新网站开发多少钱雄安建设集团有限公司网站
  • 网站建设心得感想企业网站建设要求标准说明
  • 大数据平台建站网站建设方案书 腾讯
  • 公司支付网站建设费进什么费用点评类网站建设
  • 国外网站为什么不用备案wordpress数据库加速插件
  • 做dj网站能赚钱吗汕头网站建设哪里找
  • php做网站有哪些好处南宁市流量点击推广平台
  • 做淘客网站用什么服务器好seo文章关键词怎么优化
  • 网站建设规划案例网站设计公司如何盈利
  • 天津市工程建设交易网站查汗国加密软件代理
  • 企业网站源码去一品资源网企业网站的规划与建设
  • WordPress设置腾讯企业邮箱网站优化方案基本流程
  • 对网站建设公司说高端网站建设公司哪家更专业
  • 不同域名一样的网站自己的域名可以转给做网站的账号吗
  • 学校教务网站的设计与实现wordpress允许搜索
  • 爱站关键词挖掘软件提供中小企业网站建设
  • 做烘培的网站有哪些产品如何做网站地图
  • 宁波网站制作公司哪家好做网站的网址
  • 原创文学网站建设2022年企业所得税政策
  • 一个网站可以有几个域名茂名市建设银行网站
  • 易语言如何做网站越烽建设集团有限公司网站
  • 用ppt做网站方法html5 公司网站
  • 国外 素材 网站wordpress杂志主题
  • 公司建设网站的费用深圳seo优化排名