应无所住,而生其心
排名
1
文章
872
粉丝
112
评论
163
net core webapi post传递参数
庸人 : 确实坑哈,我也是下班好了好几次,发现后台传递对象是可以的,但...
百度编辑器自定义模板
庸人 : 我建议换个编辑器,因为现在百度富文本已经停止维护了,用tinymec...
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术

uni-app 小程序,常用的弹窗模板。弹窗里边显示时间轴

1564人阅读 2024/7/16 11:51 总访问:5418966 评论:0 收藏:0 手机
分类: CSS


弹窗的基础使用以及另外的一些模板可以参考:https://www.tnblog.net/aojiancc2/article/details/7064

基础模板一:弹窗里边一点方块与文字信息(使用的grid布局)

效果图一:

弹窗里边的代码与样式一

  1. <template>
  2. <view class="popup-container">
  3. <view class="titleWrap">
  4. <view class="title">{{ title }}</view>
  5. <view class="closeTag" @tap="handleClose">×</view>
  6. </view>
  7. <view class="splitline"></view>
  8. <view class="pc-content">
  9. <view class="pcc-db-warp">
  10. <view class="pcc-db-item">
  11. <view class="pcc-db-vd-drap">
  12. <view class="pcc-dbi-value">18</view>
  13. <view class="pcc-dbi-desc">总积分</view>
  14. </view>
  15. </view>
  16. <view class="pcc-db-item">
  17. <view class="pcc-db-vd-drap">
  18. <view class="pcc-dbi-value">18</view>
  19. <view class="pcc-dbi-desc">健康</view>
  20. </view>
  21. </view>
  22. <view class="pcc-db-item">
  23. <view class="pcc-db-vd-drap">
  24. <view class="pcc-dbi-value">21</view>
  25. <view class="pcc-dbi-desc">技术</view>
  26. </view>
  27. </view>
  28. <view class="pcc-db-item">
  29. <view class="pcc-db-vd-drap">
  30. <view class="pcc-dbi-value">36</view>
  31. <view class="pcc-dbi-desc">思维</view>
  32. </view>
  33. </view>
  34. <view class="pcc-db-item">
  35. <view class="pcc-db-vd-drap">
  36. <view class="pcc-dbi-value">1</view>
  37. <view class="pcc-dbi-desc">管理</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script setup lang="ts">
  45. import { ref, reactive } from 'vue'
  46. // 父组件可以传递参数进来
  47. const props = defineProps({
  48. title: {
  49. type: String,
  50. default: "完成人次"
  51. },
  52. userList: {
  53. type: Array,
  54. default: []
  55. }
  56. })
  57. // 触发closePopup事件(关闭事件)
  58. const emit = defineEmits(['closePopup'])
  59. const handleClose = () => {
  60. emit('closePopup', '参数')
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .popup-container {
  65. height: 520rpx;
  66. background-color: #fff;
  67. border-top-left-radius: 60rpx;
  68. border-top-right-radius: 60rpx;
  69. .titleWrap {
  70. display: flex;
  71. padding-top: 22rpx;
  72. padding-left: 20rpx;
  73. padding-right: 20rpx;
  74. justify-content: center;
  75. align-items: center;
  76. /* 垂直居中 */
  77. position: relative;
  78. .title {
  79. font-family: PingFang SC, PingFang SC;
  80. font-weight: bold;
  81. font-size: 36rpx;
  82. color: #313960;
  83. }
  84. .closeTag {
  85. position: absolute;
  86. right: 16rpx;
  87. padding: 10rpx 20rpx;
  88. font-size: 50rpx;
  89. }
  90. }
  91. .splitline {
  92. margin-left: -20rpx;
  93. margin-right: -20rpx;
  94. margin-top: 30rpx;
  95. height: 1rpx;
  96. background: #f3f3f3;
  97. }
  98. .pc-content {
  99. padding-left: 20rpx;
  100. padding-right: 20rpx;
  101. .pcc-db-warp {
  102. display: grid;
  103. grid-template-columns: repeat(3, 1fr);
  104. row-gap: 20rpx;
  105. column-gap: 20rpx;
  106. margin-top: 26rpx;
  107. .pcc-db-item {
  108. background: #ECF5FF;
  109. border-radius: 6rpx 6rpx 6rpx 6rpx;
  110. border: 1rpx solid #B3D8FF;
  111. height: 106rpx;
  112. display: flex;
  113. align-items: center;
  114. justify-content: center;
  115. // flex-direction: column;
  116. .pcc-dbi-value {
  117. font-size: 24rpx;
  118. color: #4D9DF5;
  119. text-align: center;
  120. }
  121. .pcc-dbi-desc {
  122. font-weight: 400;
  123. font-size: 24rpx;
  124. color: #4D9DF5;
  125. text-align: center;
  126. margin-top: 2rpx;
  127. }
  128. }
  129. }
  130. }
  131. }
  132. </style>

弹窗里边那个圆角是在引用弹窗的时候设置的

  1. <uni-popup ref="cgsDetailsPopup" background-color="#fff" border-radius="60rpx 60rpx 0rpx 0rpx;" type="bottom"
  2. @change="methods.change">
  3. <cgsDetails @closePopup="popupMethods.closeCgsDetailsDetails" title="许灵灵"> </cgsDetails>
  4. </uni-popup>


以前圆角以及背景色这些是写到弹窗里边的,但是后面发现有些苹果手机拉到最下面背景有点问题,后面就干脆把圆角以及背景色这些写到引用弹窗组件的地方去了。其实要是能解决手机适配问题,这些写到弹窗里边还通用一点,项目时间比较紧就没有慢慢去研究了。

还有引用弹窗组件以及一些方法等代码也贴一个

  1. import cgsDetails from './component/cgs-details.vue'
  2. const state = reactive({
  3. popupShow: false,
  4. })
  5. const methods = {
  6. // 解决滚动穿透
  7. change: function (e: any) {
  8. state.popupShow = e.show
  9. },
  10. }
  11. let cgsDetailsPopup = ref()
  12. const popupMethods = {
  13. // 打开弹窗
  14. showCgsDetailsDetails: () => {
  15. cgsDetailsPopup.value.open()
  16. },
  17. // 关闭弹窗
  18. closeCgsDetailsDetails: () => {
  19. cgsDetailsPopup.value.close()
  20. }
  21. }

要解决滚动穿透,需要在页面里边第一个子元素增加一个page-meta

  1. <template>
  2. <!-- 解决滚动穿透 -->
  3. <page-meta :page-style="'overflow:' + (state.popupShow ? 'hidden' : 'visible')"></page-meta>
  4. <view></view>
  5. </template>

基础模板二:弹窗里边使用时间轴,以及每行显示4张图片

效果图二:

弹窗里边的代码与样式二

这里实现了图片超过一行后会自适应布局的,一行显示4张图

弹窗里边的内容

  1. <template>
  2. <view class="monthTaskDetails-container">
  3. <view class="titleWrap">
  4. <view class="title">{{ title }}</view>
  5. <view class="closeTag" @tap="handleClose">×</view>
  6. </view>
  7. <view class="splitline"></view>
  8. <scroll-view scroll-y="true" style=" height: 700rpx;">
  9. <view class="timeline-list">
  10. <block v-for="(item, index) in 3" :key="index">
  11. <view class="timeline-item">
  12. <view class="timeline-item_tail"></view>
  13. <view class="timeline-item_node"></view>
  14. <view class="timeline-item_wrapper">
  15. <div>已完成《参加班级扫除道》并上传照片</div>
  16. <view class="image-content">
  17. <image class="imgitem" @click="previewImg(0)" mode="scaleToFill"
  18. src="https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg">
  19. </image>
  20. <image class="imgitem" @click="previewImg(1)"
  21. src="https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg">
  22. </image>
  23. <image class="imgitem" @click="previewImg(2)"
  24. src="https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg">
  25. </image>
  26. <image class="imgitem" @click="previewImg(3)"
  27. src="https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg">
  28. </image>
  29. <image class="imgitem" @click="previewImg(4)"
  30. src="https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg">
  31. </image>
  32. <image class="imgitem" @click="previewImg(5)"
  33. src="https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg">
  34. </image>
  35. </view>
  36. <view class="extraData">
  37. <view class="task_time">
  38. 2023-08-30 16:53:08
  39. </view>
  40. <image class="deleteimg" src="../../static/delete.png">
  41. </image>
  42. </view>
  43. </view>
  44. </view>
  45. </block>
  46. </view>
  47. </scroll-view>
  48. </view>
  49. </template>
  50. <script setup lang="ts">
  51. import { ref, reactive } from 'vue'
  52. const props = defineProps({
  53. title: {
  54. type: String,
  55. default: "完成人次"
  56. },
  57. userList: {
  58. type: Array,
  59. default: []
  60. }
  61. })
  62. // 触发closePopup事件
  63. const emit = defineEmits(['closePopup'])
  64. const handleClose = () => {
  65. emit('closePopup', '参数')
  66. }
  67. // 图片预览
  68. const previewImg = (index = 0) => {
  69. uni.previewImage({
  70. urls: ['https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
  71. 'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg',
  72. 'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg',
  73. 'https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg',
  74. 'https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg',
  75. 'https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg'],
  76. current: index
  77. });
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .monthTaskDetails-container {
  82. height: 799rpx;
  83. background-color: #fff;
  84. border-top-left-radius: 60rpx;
  85. border-top-right-radius: 60rpx;
  86. .titleWrap {
  87. display: flex;
  88. padding-top: 22rpx;
  89. padding-left: 20rpx;
  90. padding-right: 20rpx;
  91. justify-content: center;
  92. align-items: center;
  93. /* 垂直居中 */
  94. position: relative;
  95. .title {
  96. font-family: PingFang SC, PingFang SC;
  97. font-weight: bold;
  98. font-size: 36rpx;
  99. color: #313960;
  100. }
  101. .closeTag {
  102. position: absolute;
  103. right: 16rpx;
  104. padding: 10rpx 20rpx;
  105. font-size: 50rpx;
  106. }
  107. }
  108. .splitline {
  109. margin-left: -20rpx;
  110. margin-right: -20rpx;
  111. margin-top: 30rpx;
  112. height: 1rpx;
  113. background: #f3f3f3;
  114. }
  115. .image-content {
  116. margin-top: 10px;
  117. display: flex;
  118. flex-wrap: wrap;
  119. justify-content: space-between;
  120. .imgitem {
  121. flex: 0 0 23%;
  122. /* 动态计算间距 */
  123. margin-right: calc(8% / 3);
  124. margin-bottom: 15rpx;
  125. height: 200rpx;
  126. background: #F6F6F6;
  127. border-radius: 0px 0px 0px 0px;
  128. opacity: 1;
  129. }
  130. /* 去除每行尾的多余边距 */
  131. .imgitem:nth-child(4n) {
  132. margin-right: 0;
  133. }
  134. /* 使最后一个元素的边距填满剩余空间 */
  135. .imgitem:last-child {
  136. margin-right: auto;
  137. }
  138. }
  139. .extraData {
  140. display: flex;
  141. margin-top: 10rpx;
  142. align-items: center;
  143. .task_time {
  144. font-size: 24rpx;
  145. color: #909399;
  146. }
  147. .deleteimg {
  148. width: 22rpx;
  149. height: 22rpx;
  150. margin-left: 20rpx;
  151. margin-top: -2rpx;
  152. }
  153. }
  154. }
  155. </style>
  156. <!-- 时间轴样式 -->
  157. <style lang="scss" scoped>
  158. .timeline-list {
  159. margin: 32rpx;
  160. margin-top: 62rpx;
  161. font-size: 28rpx;
  162. list-style: none;
  163. }
  164. .timeline-item:last-child .timeline-item_tail {
  165. display: none;
  166. }
  167. .timeline-item {
  168. position: relative;
  169. padding-bottom: 20rpx;
  170. }
  171. // 时间轴的竖线样式
  172. .timeline-item_tail {
  173. position: absolute;
  174. left: 2rpx;
  175. height: 100%;
  176. border-left: 2rpx solid rgba(109, 209, 201, 0.3);
  177. }
  178. .timeline-item_node {
  179. position: absolute;
  180. background-color: #FFFFFF;
  181. border-radius: 50%;
  182. display: flex;
  183. justify-content: center;
  184. align-items: center;
  185. left: -12rpx;
  186. width: 17rpx;
  187. height: 17rpx;
  188. background: #fff;
  189. border: 6rpx solid #E5E5E5;
  190. }
  191. // 时间轴的第一个圈的颜色
  192. .timeline-item:first-child {
  193. .timeline-item_node {
  194. border: 6rpx solid #4D9DF5;
  195. }
  196. }
  197. .timeline-item_wrapper {
  198. position: relative;
  199. // padding: 32rpx 24rpx;
  200. padding: 32rpx calc(8% / 3) 32rpx 24rpx;
  201. left: 26rpx;
  202. top: -39rpx;
  203. background-color: #ffffff;
  204. border-radius: 20rpx;
  205. }
  206. .timeline-item_timestamp {
  207. color: #38254D;
  208. font-weight: bold;
  209. font-size: 30rpx;
  210. line-height: 32rpx;
  211. }
  212. .timeline-item_content {
  213. display: flex;
  214. flex-direction: column;
  215. margin-top: 20rpx;
  216. margin-bottom: 20rpx;
  217. text {
  218. font-size: 26rpx;
  219. color: #574966;
  220. line-height: 40rpx;
  221. }
  222. .btn {
  223. align-self: flex-end;
  224. font-size: 26rpx;
  225. color: #F06245;
  226. line-height: 60rpx;
  227. text-align: center;
  228. margin-top: -40rpx;
  229. width: 140rpx;
  230. height: 60rpx;
  231. border: 1rpx solid #F06245;
  232. border-radius: 30rpx;
  233. }
  234. }
  235. </style>

父组件,使用弹窗的地方

  1. <template>
  2. <view class="body-view">
  3. <uni-popup ref="monthTaskDetailsPopup" background-color="#fff" border-radius="60rpx 60rpx 0rpx 0rpx;" type="bottom">
  4. <monthTaskDetails @closePopup="closeMonthTaskDetails" title="参加班级扫除道"> </monthTaskDetails>
  5. </uni-popup>
  6. </view>
  7. </template>
  8. <script setup lang="ts">
  9. import monthTaskDetails from './component/monthTaskDetails.vue'
  10. let monthTaskDetailsPopup = ref()
  11. // 打开弹窗
  12. const showMonthTaskDetails = () => {
  13. monthTaskDetailsPopup.value.open()
  14. }
  15. // 关闭弹窗
  16. const closeMonthTaskDetails = () => {
  17. monthTaskDetailsPopup.value.close()
  18. }
  19. </script>

基础模板三:弹窗里边包含tab选择菜单以及最下方包含取消与提交按钮

效果图三:

最下面的按钮

里边也包含一块一块的文字效果,用的flex布局,其实现在使用grid布局来实现更通用一点

弹窗里边的代码与样式三

  1. <template>
  2. <view class="container">
  3. <view class="titleWrap">
  4. <view class="tabMenu">
  5. <view :class="state.activeName == 'joinUser' ? 'titlecur' : ''" @click="switchTab('joinUser')"
  6. class="title">
  7. 参与人员</view>
  8. <view :class="state.activeName == 'noJoin' ? 'titlecur' : ''" @click="switchTab('noJoin')"
  9. class="noJoin ">缺勤人员
  10. </view>
  11. </view>
  12. </view>
  13. <view class="splitline"></view>
  14. <scroll-view scroll-y="true" style=" height: 799rpx;">
  15. <view class="completeStatusWrap" v-if="state.activeName == 'joinUser'">
  16. <view class="userItemWrap completeInfo">
  17. <view class="userItem" :class="{ choise: index % 4 === 0 }" v-for="(item, index) in 17"
  18. :key="index">张三三
  19. </view>
  20. </view>
  21. </view>
  22. <view class="completeStatusWrap" v-if="state.activeName == 'noJoin'">
  23. <view class="userItemWrap noJoinUserWrap">
  24. <view class="userItem " :class="{ choise: index % 5 === 0 }" v-for="(item, index) in 17"
  25. :key="index">张三三
  26. </view>
  27. </view>
  28. </view>
  29. </scroll-view>
  30. <view class="perateWrap">
  31. <view class="pt-cmbwrap">
  32. <view class="pt-cancelBut" @tap="handleClose">取消</view>
  33. <view class="pt-commitBut">提交</view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup lang="ts">
  39. import { ref, reactive } from 'vue'
  40. const state = reactive({
  41. activeName: "joinUser",
  42. })
  43. const switchTab = (tag: string) => {
  44. state.activeName = tag
  45. }
  46. // 触发closePopup事件
  47. const emit = defineEmits(['closePopup'])
  48. const handleClose = () => {
  49. emit('closePopup', '参数')
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .splitline {
  54. // border: 1rpx solid #E6E6E6;
  55. margin-left: -20rpx;
  56. margin-right: -20rpx;
  57. margin-top: 10rpx;
  58. height: 1rpx;
  59. background: #f3f3f3;
  60. }
  61. .container {
  62. height: 999rpx;
  63. background-color: #fff;
  64. border-top-left-radius: 20rpx;
  65. border-top-right-radius: 20rpx;
  66. .titleWrap {
  67. display: flex;
  68. padding-top: 22rpx;
  69. justify-content: space-between;
  70. padding-left: 20rpx;
  71. padding-right: 20rpx;
  72. .tabMenu {
  73. display: flex;
  74. .title {
  75. color: #909399;
  76. font-size: 26rpx;
  77. }
  78. .noJoin {
  79. margin-left: 15rpx;
  80. font-size: 26rpx;
  81. color: #909399;
  82. }
  83. .titlecur {
  84. font-size: 30rpx;
  85. color: #4D9DF5 !important;
  86. position: relative;
  87. }
  88. .titlecur:after {
  89. content: "";
  90. display: inline-block;
  91. position: absolute;
  92. bottom: -12rpx;
  93. left: 0px;
  94. width: 100%;
  95. border-bottom: 4rpx solid #4D9DF5;
  96. }
  97. }
  98. }
  99. .completeStatusWrap {
  100. margin-top: 39rpx;
  101. padding-left: 20rpx;
  102. padding-right: 20rpx;
  103. .userItemWrap {
  104. background-color: #fff;
  105. display: flex;
  106. flex-wrap: wrap;
  107. justify-content: space-between;
  108. .userItem {
  109. flex: 0 0 31%;
  110. /* 动态计算间距,除以2是因为3个元素中间只有2个缝隙 */
  111. margin-right: calc(7% / 2);
  112. margin-bottom: 15rpx;
  113. height: 65rpx;
  114. background: #F6F6F6;
  115. font-size: 26rpx;
  116. border-radius: 6rpx 6rpx 6rpx 6rpx;
  117. color: #313960;
  118. text-align: center;
  119. line-height: 65rpx;
  120. }
  121. /* 去除每行尾的多余边距 */
  122. .userItem:nth-child(3n) {
  123. margin-right: 0;
  124. }
  125. /* 使最后一个元素的边距填满剩余空间 */
  126. .userItem:last-child {
  127. margin-right: auto;
  128. }
  129. }
  130. .completeInfo {
  131. .choise {
  132. background: #F0F9EB;
  133. border: 1rpx solid #C2E7B0;
  134. box-sizing: border-box;
  135. color: #67C23A;
  136. }
  137. }
  138. .noJoinUserWrap {
  139. .choise {
  140. background: #FEF0F0;
  141. border: 1rpx solid #FBC6C6;
  142. box-sizing: border-box;
  143. color: #F56C6C;
  144. }
  145. }
  146. }
  147. .perateWrap {
  148. display: flex;
  149. justify-content: center;
  150. .pt-cmbwrap {
  151. position: absolute;
  152. bottom: 20rpx;
  153. display: flex;
  154. .pt-cancelBut {
  155. width: 330rpx;
  156. height: 80rpx;
  157. border-radius: 10rpx 10rpx 10rpx 10rpx;
  158. border: 1rpx solid #4D9DF5;
  159. font-size: 36rpx;
  160. color: #4D9DF5;
  161. text-align: center;
  162. line-height: 80rpx;
  163. margin-right: 10rpx;
  164. }
  165. .pt-commitBut {
  166. width: 330rpx;
  167. height: 80rpx;
  168. background: #4D9DF5;
  169. border-radius: 10rpx 10rpx 10rpx 10rpx;
  170. font-size: 36rpx;
  171. color: #FFFFFF;
  172. text-align: center;
  173. line-height: 80rpx;
  174. margin-left: 10rpx;
  175. }
  176. }
  177. }
  178. }
  179. </style>

基础模板四:非常基础的展示一列数据的弹窗

效果图四:

弹窗里边的代码与样式四

  1. <template>
  2. <view class="popup-container">
  3. <view class="titleWrap">
  4. <view class="title">{{ title }}</view>
  5. <view class="closeTag" @tap="handleClose">×</view>
  6. </view>
  7. <scroll-view scroll-y="true" style=" height: 666rpx;">
  8. <view class="pc-content">
  9. <view class="pcc-item" v-for="(item, index) in 13" :key="index">
  10. 23级大数据技术1班
  11. </view>
  12. </view>
  13. </scroll-view>
  14. </view>
  15. </template>
  16. <script setup lang="ts">
  17. import { ref, reactive } from 'vue'
  18. // 父组件可以传递参数进来
  19. const props = defineProps({
  20. title: {
  21. type: String,
  22. default: ""
  23. },
  24. dataList: {
  25. type: Array,
  26. default: []
  27. }
  28. })
  29. // 触发closePopup事件(关闭事件)
  30. const emit = defineEmits(['closePopup'])
  31. const handleClose = () => {
  32. emit('closePopup', '参数')
  33. }
  34. </script>
  35. <style lang="scss" scoped>
  36. .popup-container {
  37. height: 766rpx;
  38. background-color: #fff;
  39. border-top-left-radius: 60rpx;
  40. border-top-right-radius: 60rpx;
  41. .titleWrap {
  42. display: flex;
  43. padding-top: 22rpx;
  44. padding-left: 20rpx;
  45. padding-right: 20rpx;
  46. height: 50rpx;
  47. justify-content: center;
  48. align-items: center;
  49. /* 垂直居中 */
  50. position: relative;
  51. .title {
  52. font-family: PingFang SC, PingFang SC;
  53. font-weight: bold;
  54. font-size: 36rpx;
  55. color: #313960;
  56. }
  57. .closeTag {
  58. position: absolute;
  59. right: 16rpx;
  60. padding: 10rpx 20rpx;
  61. font-size: 50rpx;
  62. }
  63. }
  64. .pc-content {
  65. padding-left: 20rpx;
  66. padding-right: 20rpx;
  67. .pcc-db-warp {
  68. display: grid;
  69. grid-template-columns: repeat(3, 1fr);
  70. row-gap: 20rpx;
  71. column-gap: 20rpx;
  72. margin-top: 26rpx;
  73. .pcc-db-item {
  74. background: #ECF5FF;
  75. border-radius: 6rpx 6rpx 6rpx 6rpx;
  76. border: 1rpx solid #B3D8FF;
  77. height: 106rpx;
  78. display: flex;
  79. align-items: center;
  80. justify-content: center;
  81. // flex-direction: column;
  82. .pcc-dbi-value {
  83. font-size: 24rpx;
  84. color: #4D9DF5;
  85. text-align: center;
  86. }
  87. .pcc-dbi-desc {
  88. font-weight: 400;
  89. font-size: 24rpx;
  90. color: #4D9DF5;
  91. text-align: center;
  92. margin-top: 2rpx;
  93. }
  94. }
  95. }
  96. }
  97. .pc-content {
  98. .pcc-item {
  99. text-align: center;
  100. font-size: 36rpx;
  101. color: #313960;
  102. margin-top: 20rpx;
  103. }
  104. }
  105. }
  106. </style>

和上面那个例子一样,就多一个标题和标题下方的分割线

直接上代码

  1. <template>
  2. <view class="popup-container">
  3. <view class="titleWrap">
  4. <view class="title">{{ title }}</view>
  5. <view class="closeTag" @tap="handleClose">×</view>
  6. </view>
  7. <view class="splitline"></view>
  8. <scroll-view scroll-y="true" style=" height: 666rpx;">
  9. <view class="pc-content">
  10. <view class="pcc-item" v-for="(item, index) in 13" :key="index">
  11. 重庆应用技术职业学院
  12. </view>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. </template>
  17. <script setup lang="ts">
  18. import { ref, reactive } from 'vue'
  19. // 父组件可以传递参数进来
  20. const props = defineProps({
  21. title: {
  22. type: String,
  23. default: "选择院系"
  24. },
  25. dataList: {
  26. type: Array,
  27. default: []
  28. }
  29. })
  30. // 触发closePopup事件(关闭事件)
  31. const emit = defineEmits(['closePopup'])
  32. const handleClose = () => {
  33. emit('closePopup', '参数')
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. .popup-container {
  38. height: 766rpx;
  39. background-color: #fff;
  40. border-top-left-radius: 60rpx;
  41. border-top-right-radius: 60rpx;
  42. .titleWrap {
  43. display: flex;
  44. padding-top: 22rpx;
  45. padding-left: 20rpx;
  46. padding-right: 20rpx;
  47. height: 50rpx;
  48. justify-content: center;
  49. align-items: center;
  50. /* 垂直居中 */
  51. position: relative;
  52. .title {
  53. font-family: PingFang SC, PingFang SC;
  54. font-weight: bold;
  55. font-size: 36rpx;
  56. color: #313960;
  57. }
  58. .closeTag {
  59. position: absolute;
  60. right: 16rpx;
  61. padding: 10rpx 20rpx;
  62. font-size: 50rpx;
  63. }
  64. }
  65. .splitline {
  66. margin-left: -20rpx;
  67. margin-right: -20rpx;
  68. margin-top: 30rpx;
  69. height: 1rpx;
  70. background: #f3f3f3;
  71. }
  72. .pc-content {
  73. padding-left: 20rpx;
  74. padding-right: 20rpx;
  75. margin-top: 5rpx;
  76. .pcc-db-warp {
  77. display: grid;
  78. grid-template-columns: repeat(3, 1fr);
  79. row-gap: 20rpx;
  80. column-gap: 20rpx;
  81. margin-top: 26rpx;
  82. .pcc-db-item {
  83. background: #ECF5FF;
  84. border-radius: 6rpx 6rpx 6rpx 6rpx;
  85. border: 1rpx solid #B3D8FF;
  86. height: 106rpx;
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. // flex-direction: column;
  91. .pcc-dbi-value {
  92. font-size: 24rpx;
  93. color: #4D9DF5;
  94. text-align: center;
  95. }
  96. .pcc-dbi-desc {
  97. font-weight: 400;
  98. font-size: 24rpx;
  99. color: #4D9DF5;
  100. text-align: center;
  101. margin-top: 2rpx;
  102. }
  103. }
  104. }
  105. }
  106. .pc-content {
  107. .pcc-item {
  108. text-align: center;
  109. font-size: 36rpx;
  110. color: #313960;
  111. margin-top: 20rpx;
  112. }
  113. }
  114. }
  115. </style>

欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)

评价

uni-app开始时间与结束时间(结束时间大于开始时间)picker编写

利用uni-app官网里面picker插件代码当点击开始时间后结束时间要大于选择后的开始时间,点击结束时间后开始时间要小于开始时...

uni-app用法与html标签的变化

以前是html标签,比如,现在是小程序组件,比如。那么标签和组件有什么区别,不都是用尖括号包围起来一段英文吗?其实标签...

uni-app无法导入插件

点击网页中右上角的插件导入,可以打开项目,但是就是无法导入插件。是因为,要登录!hbuilder里边也要登录才行,他这个应...

使用uni-app的云端一体插件

初次使用uni-app的云端一体插件步骤还是有点多,也有一些坑,在这里把使用过程记录一下。 一:先下载需要的插件在插件右上...

uni-app中list插件图标问题

如图:他使用uni-icons实现的如果只有text就不会有图标有时候贴的文档不是太完善,还是要下一个完整的插件来对比一下

uni-app发起请求

代码如下:uni.request({ url:&#39;接口地址&#39;, success:(result)=&gt;{ my.lists=result.data; } })注意你的...

uni-app官方文档

https://uniapp.dcloud.io/

uni-app运行与调试

上边有菜单,可以运行到浏览器,也可以运行到内置浏览器运行到内置浏览器的效果:

uni-app引入外部资源引入外网样式

很简单代码如下:&lt;style&gt; @import&#39;http://image.tnblog.net/amazeui.min.css&#39;; &lt;/style&gt; &lt;st...

uni-app设置起始页

很简单,在pages.json里边配置即可。

uni-app页面无法跳转问题

首先检查一下有没有在pages里边配置没有配置不行的哦或者看看你的跳转方式对不对,如果跳转的是底部菜单,但是你用的是uni....

uni-app 删除失败 setting denied access to....

删除的时候如果文件夹下面还有页面,这样直接删除文件夹是会报错的:删除失败 setting denied access to....这种情况就直接...

uni-app中引入外部js

可以使用代码如下:varscript=document.createElement(&#39;script&#39;); script.src=&quot;http://image.tnblog.net/jqu...

uni-app dom操作

比如引入外部js需要用到的dom操作:varscript=document.createElement(&#39;script&#39;); script.src=&quot;http://image....

uni-app使用web-view引入页面

代码如下:&lt;template&gt; &lt;viewclass=&quot;h5-html&quot;&gt; &lt;web-view:webview-styles=&quot;webviewStyl...

uni-app真机调试

很简单只要手机开启了usb调试,然后hbuilderx会自动获取到手机的然后运行到手机即可华为手机开启use调试:一直点击版本号进...