国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

壁紙小程序Vue3(首頁布局)

這篇具有很好參考價值的文章主要介紹了壁紙小程序Vue3(首頁布局)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

1.創(chuàng)建一個公共目錄common來存放css和images

App.vue中引用

<style lang="scss">
?? ?/*每個頁面公共css */
? @import 'common/style/common-style.scss';
??
??
</style>
?

?2.渲染輪播圖

壁紙小程序Vue3(首頁布局),壁紙小程序Vue3,小程序

<template>
	<view class="homeLayout">
      <view class="banner">
        <swiper indicator-dots indicator-color="rgba(255,255,255,0.5)"
          indicator-active-color="#fff" autoplay
          circular
        >
          <swiper-item v-for="item in 3" >
              <image src="../../common/images/lxja.webp" mode="widthFix"></image>
          </swiper-item>
        </swiper>
      </view>
	</view>
</template>

<script setup>

	
</script>

<style lang="scss" scoped>
	.homeLayout{
    .banner{
      width: 750rpx;
      padding: 30rpx 0;
      swiper{
        width: 750rpx;
        height: 340rpx;
      
        // swiper-item{}
        //簡化
        &-item{
          width: 100%;
          height: 100%;
          padding: 0 30rpx;
          image{
            width: 100%;
            height: 100%;
            border-radius: 10rpx;
          }
        }
      }
    }
  }
</style>

3.公告的輪播

壁紙小程序Vue3(首頁布局),壁紙小程序Vue3,小程序

  <view class="notice">
          <view class="left">
              <uni-icons type="sound-filled" size="20" color="#28b389"></uni-icons>
              <text class="text">公告</text>
          </view>
          <view class="center">
              <swiper vertical autoplay interval="1500" duration="300" circular>
                    <swiper-item v-for="item in 4">文字內(nèi)容文字內(nèi)容文字內(nèi)容文字內(nèi)容文字內(nèi)容文字內(nèi)容</swiper-item>
              </swiper>
          </view>
          <view class="right">
                <uni-icons type="right" size="16" color="#333"></uni-icons>
          </view>
          
      </view>
  .notice{
      width: 690rpx;
      height: 80rpx;
      line-height: 80rpx;
      background: #f9f9f9;
      margin: 0 auto;
      border-radius: 80rpx;
      display: flex;
      .left{
        width: 140rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        .text{
          color: #28b389;
          font-weight: 600;
          font-size: 28rpx;
        }
      }
      .center{
        flex: 1;
        swiper{
          height: 100%;
          &-item{
            height: 100%;
            font-size: 30rpx;
            color: #666;
            //超出的文字用...替換
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }
      }
      .right{
        width: 70rpx;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

4.渲染公告下的內(nèi)容

壁紙小程序Vue3(首頁布局),壁紙小程序Vue3,小程序

創(chuàng)建公共標(biāo)題組件common-title

 <view class="select">
          <common-title></common-title>
          <view class="content">
              <scroll-view scroll-x>
                <view class="box" v-for="item in 8">
                    <image src="../../common/images/lxja.webp" mode="aspectFill"></image>
                </view>
              </scroll-view>
          </view>
      </view>

將元素的display屬性設(shè)置為inline-block可以讓元素既有行內(nèi)元素可以一行顯示多個的特性,又有塊級元素可以設(shè)置寬高的特性。?

?

.select{
      padding-top: 50rpx;
      .content{
        width: 720rpx;
        margin-left: 30rpx;
        margin-top: 30rpx;
        scroll-view{
          white-space: nowrap;
          .box{
            width: 200rpx;
            height: 430rpx;
            display: inline-block;
            margin-right: 15rpx;
            image{
              width: 100%;
              height: 100%;
              border-radius: 10rpx;
            }
          }
          .box:last-child{
            margin-right: 30rpx;
          }
        }
      }
    }
    

5.引入插槽定義公共標(biāo)題模塊

common-title

<template>
  <view class="common-title">
      <view class="name">
        <!-- 插槽 -->
        <slot name="name"></slot>
      </view>
      <view class="custom">
        <slot name="custom"></slot>
      </view>
  </view>
</template>

<script setup>
 
</script>

<style lang="scss" scoped>
.common-title{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30rpx;
  .name{
    font-size: 40rpx;
  }
}
</style>

index.vue

  <view class="select">
          <common-title>
              <template #name>每日推薦</template>
              <template #custom>
                <view class="date">
                    <uni-icons type="calendar" size="18" color="#28b389"></uni-icons>
                    <view>
                        <uni-dateformat :date="Date.now()" format="dd日"></uni-dateformat>
                    </view>
                </view>
              </template>
          </common-title>
          <view class="content">
              <scroll-view scroll-x>
                <view class="box" v-for="item in 8">
                    <image src="../../common/images/lxja.webp" mode="aspectFill"></image>
                </view>
              </scroll-view>
          </view>
      </view>
      
      <view class="theme">
          <common-title>
            <template #name>專題精選</template>
            <template #custom>
              <navigator url="" class="more">More+</navigator>
            </template>
          </common-title>
      </view>

6.渲染專題精選

壁紙小程序Vue3(首頁布局),壁紙小程序Vue3,小程序

?index.vue

 <view class="theme">
          <common-title>
            <template #name>專題精選</template>
            <template #custom>
              <navigator url="" class="more">More+</navigator>
            </template>
          </common-title>
          <view class="content">
              <theme-item v-for="item in 8"></theme-item>
          </view>
      </view>

?

.theme{
? ? ? ? padding-top: 50rpx;
? ? ? ? .more{
? ? ? ? ? font-size: 32rpx;
? ? ? ? ? color: #888;
? ? ? ? }
? ? ? ? .content{
? ? ? ? ? margin-top: 30rpx;
? ? ? ? ? padding: 0 30rpx;
? ? ? ? ? //網(wǎng)格布局
? ? ? ? ? display: grid;
? ? ? ? ? //每個元素中間有一個間隙
? ? ? ? ? gap: 15rpx;
? ? ? ? ? //一行展示三個每行平均分配
? ? ? ? ? grid-template-columns: repeat(3,1fr);
? ? ? ? }
? ? }

新創(chuàng)建一個組件them-item

<template>
  <view class="themeTtem">
      <navigator url="" class="box">
        <image class="pic" src="https://img1.baidu.com/it/u=871832137,2572636834&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1198" mode="aspectFill"></image>
        <view class="mask">盛世美顏</view>
        <view class="tab">3天前更新</view>
      </navigator>
  </view>
</template>

.themeTtem{
? .box{
? ? height: 340rpx;
? ? border-radius: 10rpx;
? ? //不加overflow:圓角顯示不出來
? ? overflow: hidden;
? ? position: relative;
? ? .pic{
? ? ? width: 100%;
? ? ? height: 100%;
? ? }
? ? .mask{
? ? ? width: 100%;
? ? ? height: 70rpx;
? ? ? position: absolute;
? ? ? bottom: 0;
? ? ? left: 0;
? ? ? //磨砂透明
? ? ? background: rgba(0,0,0,0.2);
? ? ? color: #fff;
? ? ? display: flex;
? ? ? align-items: center;
? ? ? justify-content: center;
? ? ? //模糊濾鏡
? ? ? backdrop-filter: blur(20rpx);
? ? ? font-weight: 600;
? ? ? font-size: 30rpx;
? ? }
? ? .tab{
? ? ? position: absolute;
? ? ? left: 0;
? ? ? top: 0;
? ? ? background: rgba(250,129,90,0.7);
? ? ? backdrop-filter: blur(20rpx);
? ? ? color: #fff;
? ? ? font-size: 22rpx;
? ? ? padding: 6rpx 14rpx;
? ? ? //左上 右上 右下 ?左下
? ? ? border-radius: 0 0 20rpx 0;
? ? ? //網(wǎng)格文字最小為12px,要想小于12px,可進行如下操作
? ? ? //縮放
? ? ? transform: scale(0.8);
? ? ? //以左上角基準(zhǔn)偏移
? ? ? transform-origin: left top;
? ? }
? }
}
?

1)渲染更多標(biāo)題

壁紙小程序Vue3(首頁布局),壁紙小程序Vue3,小程序

index.vue

?<view class="theme">
? ? ? ? ? <common-title>
? ? ? ? ? ? <template #name>專題精選</template>
? ? ? ? ? ? <template #custom>
? ? ? ? ? ? ? <navigator url="" class="more">More+</navigator>
? ? ? ? ? ? </template>
? ? ? ? ? </common-title>
? ? ? ? ? <view class="content">
? ? ? ? ? ? ? <theme-item v-for="item in 8"></theme-item>
? ? ? ? ? ? ? <theme-item :isMore="true"></theme-item>
? ? ? ? ? </view>

? ? ? </view>

?them-item

?<view class="themeTtem">
? ? ? <navigator url="" class="box" v-if="!isMore">
? ? ? ? <image class="pic" src="https://img1.baidu.com/it/u=871832137,2572636834&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1198" mode="aspectFill"></image>
? ? ? ? <view class="mask">盛世美顏</view>
? ? ? ? <view class="tab">3天前更新</view>
? ? ? </navigator>
? ? ? <navigator url="" class="box more" v-else>
? ? ? ? <image class="pic" src="https://img1.baidu.com/it/u=351608013,944758287&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=751" mode="aspectFill"></image>
? ? ? ? <view class="mask">
? ? ? ? ? <uni-icons type="more-filled" size="34" color="#fff"></uni-icons>
? ? ? ? ? <view class="text">更多</view>
? ? ? ? </view>
? ? ? </navigator>

? </view>

.box.more{
? ? .mask{
? ? ? width: 100%;
? ? ? height: 100%;
? ? ? flex-direction: column;
? ? }
? ? .text{
? ? ? font-size: 28rpx;
? ? }
? }文章來源地址http://www.zghlxwxcb.cn/news/detail-844742.html

到了這里,關(guān)于壁紙小程序Vue3(首頁布局)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 微信小程序首頁-----布局(詳細教程趕快收藏吧)

    微信小程序首頁-----布局(詳細教程趕快收藏吧)

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? 艷艷耶??:個人主頁 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? 個人專欄 :《Spring與Mybatis集成整合》《Vue.js使用》 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? 越努力 ,越幸運

    2024年02月04日
    瀏覽(32)
  • 【小程序從0到1】首頁布局案例的實現(xiàn)

    【小程序從0到1】首頁布局案例的實現(xiàn)

    歡迎來到我的博客 ??博主是一名大學(xué)在讀本科生,主要學(xué)習(xí)方向是前端。 ??目前已經(jīng)更新了 【Vue】、【React–從基礎(chǔ)到實戰(zhàn)】、【TypeScript】等等系列專欄 ??目前正在學(xué)習(xí)的是?? R e a c t / 小程序 React/小程序 R e a c t / 小程序 ??,中間穿插了一些基礎(chǔ)知識的回顧 ??博客主

    2024年02月03日
    瀏覽(11)
  • 微信小程序首頁、界面布局、自定義頂部(示例一)

    微信小程序首頁、界面布局、自定義頂部(示例一)

    具體界面見下圖: 如需界面中引用的圖片文件和更多功能,請滑動至底部查看下載鏈接,可下載完整版,下載后直接使用微信開發(fā)者工具打開即可,完整版功能更詳細呦。當(dāng)前界面的布局樣式代碼如下(如存在不足之處,請根據(jù)具體需求,自行修改): 1、js代碼: 2、wxml代

    2024年02月12日
    瀏覽(33)
  • 【微信小程序(黑馬程序課程)案例實現(xiàn)——本地生活的首頁基本布局】

    【微信小程序(黑馬程序課程)案例實現(xiàn)——本地生活的首頁基本布局】

    一. 新建一個項目 二. 添加頁面和刪除頁面 (1) 添加頁面 ——app.json/pages中添加路徑,并刪除原有的路徑 (2)刪除頁面——路徑已經(jīng)被刪除,現(xiàn)在刪除文件 三.設(shè)置導(dǎo)航欄效果 ——app.json/windows中更改 效果圖: 代碼如下: 四.設(shè)置tabBar效果 ——在app.json中創(chuàng)建tabBar(與win

    2024年04月16日
    瀏覽(36)
  • 微信小程序首頁、界面布局、3D輪播圖效果(示例二)

    微信小程序首頁、界面布局、3D輪播圖效果(示例二)

    使用swiper實現(xiàn)3D輪播圖效果,自定義頂部狀態(tài)欄,具體代碼: 1、js代碼 2、wxml代碼 3、wxss代碼 4、json代碼 如需要下載完整版,包含監(jiān)聽事件、圖片文件等,請前往下方鏈接,下載完整版,下載后直接使用微信開發(fā)者工具打開即可,下載鏈接為: 小程序完整版界面(示例二)

    2024年02月10日
    瀏覽(28)
  • 微信小程序 —— 會議OA項目首頁布局與Mock數(shù)據(jù)交互

    微信小程序 —— 會議OA項目首頁布局與Mock數(shù)據(jù)交互

    14天閱讀挑戰(zhàn)賽 如果世界上有奇跡,那一定是努力的另一個名字。 目錄 一、小程序布局 1.1 Flex布局 1.2 Flex屬性 ? 二、OA會議首頁搭建 2.1?首頁底部菜單 2.2?創(chuàng)建后端結(jié)口 2.3?Mock模擬數(shù)據(jù) 2.4 首頁輪播圖搭建 2.5?首頁內(nèi)容搭建? 布局的傳統(tǒng)解決方案,基于盒狀模型,依賴 dis

    2024年02月08日
    瀏覽(23)
  • 微信小程序進階——Flex彈性布局&輪播圖&會議OA項目(首頁)

    微信小程序進階——Flex彈性布局&輪播圖&會議OA項目(首頁)

    目錄 一、Flex彈性布局 1.1 什么是Flex彈性布局 1.1.1 詳解 1.1.2 圖解? 1.1.3 代碼演示效果 1.2 Flex彈性布局的核心概念 1.3?Flex 彈性布局的常見屬性 1.4 Flex彈性布局部分屬性詳解 1.4.1?flex-direction屬性 1.4.2?flex-wrap屬性 1.4.3?flex-flow屬性 1.4.4?justify-content屬性 1.4.5?align-items屬性 1.4.6?

    2024年02月05日
    瀏覽(30)
  • 微信小程序之會議OA系統(tǒng)首頁布局搭建與Mock數(shù)據(jù)交互

    微信小程序之會議OA系統(tǒng)首頁布局搭建與Mock數(shù)據(jù)交互

    目錄 前言 一、Flex 布局(?分類?編程技術(shù)) 1、Flex布局是什么? 2、基本概念 3、容器的屬性 3.1 flex-direction屬性 3.2 flex-wrap屬性 3.3 flex-flow 3.4 justify-content屬性 3.5 align-items屬性 3.6 align-content屬性 4、項目的屬性 4.1 order屬性 4.2 flex-grow屬性 4.3 flex-shrink屬性 4.4 flex-basis屬性 4.5 fl

    2024年02月08日
    瀏覽(22)
  • vue3框架Vite + vue Router + ts 登錄后返回上一頁或首頁

    vue3框架Vite + vue Router + ts 登錄后返回上一頁或首頁

    項目(Vue3):Vite + vue Router + ts 登錄后跳轉(zhuǎn)情況: ① 項目中有些頁面是需要登錄后才可以訪問的,如果沒有登錄的情況下,訪問該頁面會自動跳轉(zhuǎn)到登錄頁,完成登錄操作后,需要再次返回到該頁面 ② 如果直接訪問登錄頁,登錄后跳轉(zhuǎn)到首頁 訪問頁面時,進行限制,除了部分

    2024年02月04日
    瀏覽(43)
  • vue3-實戰(zhàn)-12-管理后臺-權(quán)限管理之菜單管理模塊-首頁-主題顏色-暗黑模式

    vue3-實戰(zhàn)-12-管理后臺-權(quán)限管理之菜單管理模塊-首頁-主題顏色-暗黑模式

    目錄 1-列表頁面功能開發(fā) 1.1-需求原型分析 1.2-接口和數(shù)據(jù)類型定義 1.3-獲取服務(wù)端數(shù)據(jù)渲染頁面 2-新增編輯菜單 2.1-原型需求分析 2.2-表單數(shù)據(jù)收集和頁面結(jié)構(gòu)開發(fā) 2.3-提交或者取消 3-刪除菜單 4-首頁開發(fā) 5-暗黑模式的切換和主題顏色 5.1-暗黑模式 5.2-主題顏色切換 ? ? ? 我們

    2024年02月10日
    瀏覽(17)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包