当前位置:   article > 正文

壁纸小程序Vu3(预览页面:弹窗)

壁纸小程序Vu3(预览页面:弹窗)

1.展示跳转后的分类列表图片

classlist.vue

 

  1. <template>
  2. <view class="classlist">
  3. <view class="content">
  4. <navigator class="item" v-for="item in 10">
  5. <image src="../../common/images/64.png" mode="aspectFill"></image>
  6. </navigator>
  7. </view>
  8. </view>
  9. </template>
  10. <script setup>
  11. </script>
  12. <style lang="scss" scoped>
  13. .classlist{
  14. .content{
  15. //网格布局
  16. display: grid;
  17. grid-template-columns: repeat(3,1fr);
  18. gap:5rpx;
  19. padding: 5rpx;
  20. .item{
  21. height: 440rpx;
  22. image{
  23. width: 100%;
  24. height: 100%;
  25. display: block;
  26. }
  27. }
  28. }
  29. }
  30. </style>

2.预览页面(preview.vue)

1)基础布局

  1. <template>
  2. <view class="preview">
  3. <swiper circular>
  4. <swiper-item v-for="item in 4">
  5. <image @click="maskChange" src="../../static/images/2.jpg" mode="aspectFill"></image>
  6. </swiper-item>
  7. <swiper-item>
  8. <image src="../../static/images/1.jpeg" mode="aspectFill"></image>
  9. </swiper-item>
  10. </swiper>
  11. <view class="mask" v-if="maskState">
  12. <view class="goBack"></view>
  13. <view class="count">3 / 9</view>
  14. <view class="time">
  15. <uni-dateformat :date="new Date()" format="hh:mm"></uni-dateformat>
  16. </view>
  17. <view class="date">
  18. <uni-dateformat :date="new Date()" format="MM月dd日"></uni-dateformat>
  19. </view>
  20. <view class="footer">
  21. <view class="box">
  22. <uni-icons type="info" size="28"></uni-icons>
  23. <view class="text">信息</view>
  24. </view>
  25. <view class="box">
  26. <uni-icons type="star" size="28"></uni-icons>
  27. <view class="text">5</view>
  28. </view>
  29. <view class="box">
  30. <uni-icons type="download" size="23"></uni-icons>
  31. <view class="text">下载</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. import { ref } from 'vue';
  39. //遮盖层
  40. const maskState = ref(false)
  41. const maskChange = ()=>{
  42. maskState.value = !maskState.value
  43. }
  44. </script>
  45. <style lang="scss" >
  46. .preview{
  47. width: 100%;
  48. height: 100vh;
  49. swiper{
  50. width: 100%;
  51. height: 100%;
  52. image{
  53. width: 100%;
  54. height: 100%;
  55. }
  56. }
  57. .mask{
  58. //&>view:紧邻的子元素
  59. //公用的
  60. &>view{
  61. position: absolute;
  62. left: 0;
  63. margin: auto;
  64. color: #fff;
  65. right: 0;
  66. //内容多大就有多宽=>自动扩宽
  67. width: fit-content;
  68. }
  69. .goBack{
  70. }
  71. .count{
  72. position: absolute;
  73. top: 10vh;
  74. background: rgba(0, 0, 0, 0.3);
  75. font-size: 28rpx;
  76. border-radius: 40rpx;
  77. padding: 8rpx 28rpx;
  78. //模糊效果
  79. backdrop-filter: blur(10rpx);
  80. }
  81. .time{
  82. font-size: 140rpx;
  83. top: calc(10vh + 80rpx);
  84. font-weight: 100;
  85. line-height: 1em;
  86. //文字阴影
  87. text-shadow: 0 4rpx rgba(0, 0, 0, 0.3);
  88. }
  89. .date{
  90. font-size: 34rpx;
  91. top: calc(10vh + 240rpx);
  92. text-shadow: 0 4rpx rgba(0, 0, 0, 0.3);
  93. }
  94. .footer{
  95. background: rgba(255, 255, 255, 0.8);
  96. bottom: 10vh;
  97. width: 65vw;
  98. height: 120rpx;
  99. border-radius: 120rpx;
  100. color: #000;
  101. display: flex;
  102. //平均分配
  103. justify-content: space-around;
  104. //正中间
  105. align-items: center;
  106. //避免背景白色时看不到区域
  107. box-shadow: 0 2rpx 0 rgba(0, 0, 0, 0.1);
  108. backdrop-filter: blur(20rpx);
  109. .box{
  110. display: flex;
  111. flex-direction: column;
  112. align-items: center;
  113. justify-content: center;
  114. //增加触碰区域
  115. padding: 2rpx 12rpx;
  116. .text{
  117. font-size: 26rpx;
  118. color: $text-font-color-2;
  119. }
  120. }
  121. }
  122. }
  123. }
  124. </style>

显示时间的组件

<view class="time">
              <uni-dateformat :date="new Date()" format="hh:mm"></uni-dateformat>
          </view>

 .mask{
      //&>view:紧邻的子元素
      //公用的
      &>view{
        position: absolute;
        left: 0;
        margin: auto;
        color: #fff;
        right: 0;
        //内容多大就有多宽=>自动扩宽
        width: fit-content;
      }

top: calc(10vh + 240rpx);是一种CSS样式声明,用于设置元素的垂直位置。

3.弹窗的设置

1).壁纸信息弹窗

  1. <!-- 弹框 -->
  2. <uni-popup ref="infoPopup" type="bottom">
  3. <view class="infoPopup">
  4. <view class="popHeader">
  5. <view></view>
  6. <view class="title">壁纸信息</view>
  7. <view class="close" @click="clickInfoClose">
  8. <uni-icons type="closeempty" size="18" color="#999" ></uni-icons>
  9. </view>
  10. </view>
  11. <!-- scroll-view限制最大区域 -->
  12. <scroll-view scroll-y>
  13. <view class="content">
  14. <view class="row" >
  15. <view class="label">壁纸ID: </view>
  16. <text selectable class="value">112124124sfgd</text>
  17. </view>
  18. <view class="row">
  19. <view class="label">分类:</view>
  20. <text class="value class">明星美女</text>
  21. </view>
  22. <view class="row">
  23. <view class="label">发布者:</view>
  24. <text class="value">君泺</text>
  25. </view>
  26. <view class="row">
  27. <text class="label">评分:</text>
  28. <view class='value roteBox' >
  29. <uni-rate readonly touchable value="3.5" size="16"/>
  30. <text class="score">5</text>
  31. </view>
  32. </view>
  33. <view class="row">
  34. <text class="label">摘要:</text>
  35. <view class='value'>
  36. 摘要文字内容填充部分,摘要文字内容填充部分,摘要文字内容填充部分,摘要文字内容填充部分。
  37. </view>
  38. </view>
  39. <view class="row">
  40. <text class="label">标签:</text>
  41. <view class='value tabs'>
  42. <view class="tab" v-for="item in 3">标签名</view>
  43. </view>
  44. </view>
  45. <view class="copyright">声明:本图片来用户投稿,非商业使用,用于免费学习交流,
  46. 如侵犯了您的权益,您可以拷贝壁纸ID举报至平台,邮箱513894357@qq.com,管理将删除侵权壁纸,维护您的权益。</view>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. </uni-popup>

 


<script setup>
import { ref } from 'vue';
//遮盖层
const maskState = ref(true)
const infoPopup = ref(null)

//点击info弹窗
const clickInfo = ()=>{
    infoPopup.value.open();
}

//点击关闭信息弹窗
const clickInfoClose = ()=>{
  infoPopup.value.close();
}

const maskChange = ()=>{
   maskState.value = !maskState.value
}
</script>
 

2)评分弹窗

 preview.vue

  1. <!-- :is-mask-click="false":点击×才能进行关闭,点击空白不关闭 -->
  2. <uni-popup ref="scorePopup" :is-mask-click="false">
  3. <view class="scorePopup">
  4. <view class="popHeader">
  5. <view></view>
  6. <view class="title" >壁纸评分</view>
  7. <view class="close" @click="clickScoreClose">
  8. <uni-icons type="closeempty" size="18" color="#999" ></uni-icons>
  9. </view>
  10. </view>
  11. <view class="content">
  12. <!-- allowHalf:0.5分 -->
  13. <uni-rate v-model="userScore" allowHalf></uni-rate>
  14. <text class="text">{{userScore}}分</text>
  15. </view>
  16. <view class="footer">
  17. <!-- :disabled="!userScore" 只有进行评分时才生效 -->
  18. <button @click="submitScore" :disabled="!userScore" type="default" size="mini" plain>确认评分</button>
  19. </view>
  20. </view>
  21. </uni-popup>


<script setup>
import { ref } from 'vue';
//遮盖层
const maskState = ref(true)
const infoPopup = ref(null)
const scorePopup = ref(null)
const userScore = ref(0)
//点击info弹窗
const clickInfo = ()=>{
    infoPopup.value.open();
}
//点击关闭信息弹窗
const clickInfoClose = ()=>{
  infoPopup.value.close();
}
//评分弹窗
const clickScore = () =>{
  scorePopup.value.open();

}
//关闭
const clickScoreClose =  ()=>{
  scorePopup.value.close();

}
const maskChange = ()=>{
   maskState.value = !maskState.value
}

//确认评分
const submitScore = () =>{
  console.log("评分了");
}
</script>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/386370
推荐阅读
相关标签
  

闽ICP备14008679号