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

壁纸小程序Vue3(分类页面和用户页面基础布局)

1.配置tabBar

 pages.json

 "tabBar": {"color": "#9799a5","selectedColor": "#28B389","list": [{"text": "推荐","pagePath": "pages/index/index","iconPath": "static/images/tabBar/home.png","selectedIconPath": "static/images/tabBar/home-h.png"},{"text": "分类","pagePath": "pages/classify/classify","iconPath": "static/images/tabBar/classify.png","selectedIconPath": "static/images/tabBar/classify-h.png"},{"text": "我的","pagePath": "pages/user/user","iconPath": "static/images/tabBar/user.png","selectedIconPath": "static/images/tabBar/user-h.png"}]}

 2.分类页面

 classify.vue

 

<template><view class="classLayout"><view class="classify"><theme-item v-for="item in 15"></theme-item></view></view>
</template><script setup></script>
<style lang="scss" scoped>
.classify{padding: 30rpx;display: grid;grid-template-columns: repeat(3,1fr);gap: 15rpx;
}
</style>

 

3.我的页面 

user.vue 

 1)基础布局

 <view class="userLayout"><view class="userInfo"><view class="avatar"><image src="/common/images/64.png" mode="aspectFill"></image></view><view class="ip">192.168.10.100</view><view class="address">来自于:深圳</view></view><view class="section"><view class="list"><view class="row" v-for="item in 3"><view class="left"><uni-icons type="download-filled" size="20" color="#28b389"></uni-icons><view class="text">我的下载</view></view><view class="right"><view class="text">33</view><uni-icons type="right" size="15" color="#aaa"> </uni-icons></view></view></view></view><view class="section"><view class="list"><view class="row" v-for="item in 2"><view class="left"><uni-icons type="download-filled" size="20" color="#28b389"></uni-icons><view class="text">我的下载</view></view><view class="right"><view class="text">33</view><uni-icons type="right" size="15" color="#aaa"> </uni-icons></view></view></view></view></view>
.userLayout{.userInfo{display: flex;align-items: center;justify-content: center;flex-direction: column;.avatar{width: 160rpx;height: 160rpx;border-radius: 50%;overflow: hidden;image{width: 100%;height: 100%;}}.ip{font-size: 44rpx;color: #333;padding: 20rpx 0 5rpx;}.address{font-size: 28rpx;color: #aaa;}    }.section{width: 690rpx;margin: 50rpx auto;border: 1px solid #eee;border-radius: 10rpx;//设置阴影box-shadow: 0 0 30rpx rgba(0, 0, 0, 0.05);.list{.row{display: flex;justify-content: space-between;padding: 0 30rpx;height: 100rpx;//线border-bottom: 1px solid #eee;//去掉最后一条重复的线  &:代表在当前标签下&:last-child{border-bottom: 0;}.left{display: flex;align-items: center;.text{padding-left: 20rpx;color: #666;}}.right{display: flex;align-items: center;.text{font-size: 28rpx;color: #aaa;}}}}} }

2)设置客服/拨打电话按钮

<view class="section">
          <view class="list">
              <view class="row">
                  <view class="left">
                    <uni-icons type="chatboxes-filled" size="20" color="#28b389"></uni-icons>
                    <view class="text">联系客服</view>
                  </view>
                  <view class="right">
                      <view class="text">33</view>
                      <uni-icons type="right" size="15" color="#aaa"> </uni-icons>
                  </view>

//条件编译
                     <!-- #ifdef MP -->
                    <button open-type="contact">联系客服</button>
                    <!-- #endif -->
                    <!-- #ifndef MP -->
                    <button @click="clickContact">拨打电话</button>
                    <!-- #endif -->                
              </view>
          </view>
      </view>

  //客服按钮
        button{
          position: absolute;
          top: 0;
          left: 0;
          height: 100rpx;
          width: 100%;
          opacity: 0;
        }

4.设置全局线性渐变背景色

 user.vue

<view class="userLayout pageBg">

 common-style.scss

 

view,swiper,swiper-item{
  //内填充
  box-sizing: border-box;
}

.pageBg{
  //线性渐变
  //从左到右
  // background: linear-gradient(to right,red,#fff,green);
  //transparent:也可以表示透明色
  background: 
  // linear-gradient(to bottom,rgba(0,0,0,0) 50%,#fff 100%),
  linear-gradient(to bottom,rgba(0,0,0,0) , #fff  400rpx),
  linear-gradient(to right,#beecd8 20%,#F4E2D8)
  ;
  min-height: 80vh;

  
}
 

5.自定义颜色变量

在common下创建base-style.scss

在官方文件uni.scss中导入:@import "@/common/style/base-style.scss";

注:导入重启时,需要重新运行Uniapp,这样才不会报错

$brand-theme-color:#28B389;      //品牌主体红色

$border-color:#e0e0e0;           //边框颜色
$border-color-light:#efefef;     //边框亮色

$text-font-color-1:#000;         //文字主色
$text-font-color-2:#676767;      //副标题颜色
$text-font-color-3:#a7a7a7;      //浅色
$text-font-color-4:#e4e4e4;      //更浅

使用

.date{
        color: $brand-theme-color;
   }

//这样写在H5中可以生效,小程序中不能生效

 .uni-icons{
          //!important:代表权重最高
          color: $brand-theme-color !important;
    }

//所以修改为如下即可:

 //穿透到组件内部,去改变组件类名
        :deep(){
          .uni-icons{
            //!important:代表权重最高
            color: $brand-theme-color !important;
          }
        }

 

相关文章:

  • 大型语言模型可以“在两年内彻底改变金融业”
  • 常用VPS服务器检测脚本
  • 蓝桥杯省赛刷题——题目 2656:刷题统计
  • 维修贝加莱4PP420.1043-B5触摸屏Power Panel 400工业电脑液晶
  • Day54:WEB攻防-XSS跨站Cookie盗取表单劫持网络钓鱼溯源分析项目平台框架
  • T2最长的AB序列(20分) - 京东前端笔试编程题题解
  • 拿到运营商给的IP池
  • 课时81:流程控制_循环控制_continue实践
  • go: go.mod file not found in current directory or any parent directory.如何解决?
  • C++20中的jthread
  • ES学习日记(三)-------第三方插件选择
  • 【Laravel】07 快速套用一个网站模板
  • 如何通过Elasticsearch实现搜索的关键词达到高亮的效果
  • Day1 - Hive基础知识
  • HarmonyOS 应用开发之Stage模型启动FA模型PageAbility
  • interface和setter,getter
  • iOS仿今日头条、壁纸应用、筛选分类、三方微博、颜色填充等源码
  • Java-详解HashMap
  • JDK 6和JDK 7中的substring()方法
  • Node.js 新计划:使用 V8 snapshot 将启动速度提升 8 倍
  • vue2.0一起在懵逼的海洋里越陷越深(四)
  • 海量大数据大屏分析展示一步到位:DataWorks数据服务+MaxCompute Lightning对接DataV最佳实践...
  • 什么软件可以提取视频中的音频制作成手机铃声
  • 怎样选择前端框架
  • NLPIR智能语义技术让大数据挖掘更简单
  • 说说我为什么看好Spring Cloud Alibaba
  • ​3ds Max插件CG MAGIC图形板块为您提升线条效率!
  • #pragma once
  • (2.2w字)前端单元测试之Jest详解篇
  • (Bean工厂的后处理器入门)学习Spring的第七天
  • (delphi11最新学习资料) Object Pascal 学习笔记---第8章第2节(共同的基类)
  • (六)激光线扫描-三维重建
  • (四)Linux Shell编程——输入输出重定向
  • (中等) HDU 4370 0 or 1,建模+Dijkstra。
  • ***原理与防范
  • .halo勒索病毒解密方法|勒索病毒解决|勒索病毒恢复|数据库修复
  • .NET Core 成都线下面基会拉开序幕
  • .Net多线程总结
  • /usr/bin/env: node: No such file or directory
  • @angular/cli项目构建--Dynamic.Form
  • @configuration注解_2w字长文给你讲透了配置类为什么要添加 @Configuration注解
  • [Angular 基础] - 指令(directives)
  • [Asp.net MVC]Asp.net MVC5系列——Razor语法
  • [autojs]autojs开关按钮的简单使用
  • [EFI]MSI GF63 Thin 9SCXR电脑 Hackintosh 黑苹果efi引导文件
  • [JavaScript]_[初级]_[关于forin或for...in循环语句的用法]
  • [linux] shell中的()和{}
  • [Linux打怪升级之路]-信号的保存和递达
  • [MTK]安卓8 ADB执行ota升级
  • [NOI2022] 众数 题解
  • [pytorch入门] 3. torchvision中的transforms
  • [Rust] 快速基础入门教程
  • [springboot专栏]文件本地上传与提供访问服务
  • [VSCode] Shortcuts
  • [Web开发] IE8中如何防御网站被Clickjacking攻击