03 - Vue3 UI Framework - 首页
顶部边栏做完了,接下来开始做官网的首页
返回阅读列表点击 这里
创建视图文件夹
让我们先新建一个 src/views
文件夹,用来存放官网的主要视图
然后在该文件夹下新建两个 vue 文件,作为我们的视图
Home.vue
,首页Document.vue
,文档页
再配置一下 router.ts
来实现跳转
import { createWebHistory, createRouter } from 'vue-router'
import Home from './views/Home.vue'
import Document from './views/Document.vue'
const history = createWebHistory()
const router = createRouter({
history,
routes: [
{ path: '/', component: Home },
{ path: '/document', component: Document },
]
})
export default router
骨架
先搭建一下首页的骨架
已知首页要显示
- 顶边栏
- 极光背景
- 两个跳转链接
- 三点特性
首先是极光背景,非常简单,用渐变色 + 转向当作背景色就可以了,然后三点特性,显然是无序列表,那么可以得到如下骨架:
<template>
<div>
<Topnav />
<div class="banner">
<a href="https://github.com/JeremyWu917/jeremy-ui"> Github </a>
<router-link to="/document"> 文档页 </router-link>
</div>
<div class="features">
<ul>
<li>特性1</li>
<li>特性2</li>
<li>特性3</li>
</ul>
</div>
</div>
</template>
基本功能
然后在 script 中引入顶边栏
import Topnav from "../components/Topnav.vue";
export default {
components: {
Topnav,
},
};
最后制作一下极光的样式表
<style lang="scss" scoped>
$theme-color: #8c6fef;
$border-radius: 4px;
$color: white;
.banner {
background: linear-gradient(
145deg,
rgb(232, 232, 235) 0%,
rgb(193, 181, 235) 30%,
rgb(136, 106, 235) 70%,
rgb(108, 68, 240) 100%
);
clip-path: ellipse(80% 60% at 50% 40%);
}
.features {
margin: 64px auto;
padding: 0 16px;
@media (min-width: 800px) {
width: 800px;
> ul {
> li {
width: 50%;
}
}
}
@media (min-width: 1200px) {
width: 1200px;
> ul {
> li {
width: 33.3333%;
}
}
}
@media (max-width: 800px) {
> ul {
flex-direction: column;
align-items: center;
}
}
> ul {
display: flex;
flex-wrap: wrap;
> li {
margin: 16px 0;
display: grid;
justify-content: center;
align-content: space-between;
grid-template-areas:
"icon title"
"icon text";
grid-template-columns: 80px auto;
grid-template-rows: 1fr auto;
> svg {
grid-area: icon;
width: 64px;
height: 64px;
}
> h3 {
grid-area: title;
font-size: 28px;
}
> p {
grid-area: text;
}
}
}
}
.banner {
color: $color;
padding-top: 120px;
padding-bottom: 20px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
> * {
margin: 12px 0;
}
> .actions {
padding: 8px 0;
a {
margin: 0 8px;
display: inline-block;
padding: 8px 24px;
&:hover {
text-decoration: none;
}
> img {
display: block;
width: 80px;
}
text-align: center;
}
}
}
</style>
改进首页
那显然,特性应该单独占据一行,并且在宽度足够的时候横向排列,两个链接也最好横向排列,而且最好各自有点介绍。
先修改模板,再补全样式,再加个 SVG
图,home.vue
代码如下:
<template>
<div>
<Topnav />
<div class="banner">
<h1>Jeremy UI</h1>
<h2>JeremyWU 创建的 UI 组件库</h2>
<p class="actions">
<a href="https://github.com/JeremyWu917/jeremy-ui">
<img
src="../assets/github.png"
alt="Github"
style="transform: rotateY(180deg)"
/>
Github
</a>
<router-link to="/document">
<img src="../assets/goto.png" alt="开始" />
开始
</router-link>
</p>
</div>
<div class="features">
<ul>
<li>
<svg>
<use xlink:href="#icon-Vue"></use>
</svg>
<h3>基于 Vue 3</h3>
<p>使用了 Vue 3 全新特性</p>
</li>
<li>
<svg>
<use xlink:href="#icon-typescript"></use>
</svg>
<h3>基于 TypeScript</h3>
<p>源代码采用 TypeScript 书写</p>
</li>
<li>
<svg>
<use xlink:href="#icon-fork"></use>
</svg>
<h3>具有亲和力的代码</h3>
<p>新手也能轻松阅读的源代码</p>
</li>
</ul>
</div>
</div>
</template>
<script lang="ts">
import Topnav from "../components/Topnav.vue";
export default {
components: {
Topnav,
},
};
</script>
<style lang="scss" scoped>
$theme-color: #8c6fef;
$border-radius: 4px;
$color: white;
.banner {
background: linear-gradient(
145deg,
rgb(232, 232, 235) 0%,
rgb(193, 181, 235) 30%,
rgb(136, 106, 235) 70%,
rgb(108, 68, 240) 100%
);
clip-path: ellipse(80% 60% at 50% 40%);
}
.features {
margin: 64px auto;
padding: 0 16px;
@media (min-width: 800px) {
width: 800px;
> ul {
> li {
width: 50%;
}
}
}
@media (min-width: 1200px) {
width: 1200px;
> ul {
> li {
width: 33.3333%;
}
}
}
@media (max-width: 800px) {
> ul {
flex-direction: column;
align-items: center;
}
}
> ul {
display: flex;
flex-wrap: wrap;
> li {
margin: 16px 0;
display: grid;
justify-content: center;
align-content: space-between;
grid-template-areas:
"icon title"
"icon text";
grid-template-columns: 80px auto;
grid-template-rows: 1fr auto;
> svg {
grid-area: icon;
width: 64px;
height: 64px;
}
> h3 {
grid-area: title;
font-size: 28px;
}
> p {
grid-area: text;
}
}
}
}
.banner {
color: $color;
padding-top: 120px;
padding-bottom: 20px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
> * {
margin: 12px 0;
}
> .actions {
padding: 8px 0;
a {
margin: 0 8px;
display: inline-block;
padding: 8px 24px;
&:hover {
text-decoration: none;
}
> img {
display: block;
width: 80px;
}
text-align: center;
}
}
}
</style>
运行效果
感谢阅读
03 - Vue3 UI Framework - 首页的更多相关文章
- 00 - Vue3 UI Framework - 阅读辅助列表
阅读列表 01 - Vue3 UI Framework - 开始 02 - Vue3 UI Framework - 顶部边栏 03 - Vue3 UI Framework - 首页 04 - Vue3 ...
- 01 - Vue3 UI Framework - 开始
写在前面 一年多没写过博客了,工作.生活逐渐磨平了棱角. 写代码容易,写博客难,坚持写高水平的技术博客更难. 技术控决定慢慢拾起这份坚持,用作技术学习的阶段性总结. 返回阅读列表点击 这里 开始 大前 ...
- 05 - Vue3 UI Framework - Button 组件
官网基本做好了,接下来开始做核心组件 返回阅读列表点击 这里 目录准备 在项目 src 目录下创建 lib 文件夹,用来存放所有的核心组件吧.然后再在 lib 文件夹下创建 Button.vue 文件 ...
- 02 - Vue3 UI Framework - 顶部边栏
顶部边栏比较简单,而且首页和文档页都需要,所以我们先从顶部边栏做起 前文回顾点击 这里 返回阅读列表点击 这里 初始化 首先,在 components 文件夹下,创建一个 vue 组件,命名为 Top ...
- 04 - Vue3 UI Framework - 文档页
官网的首页做完了,接下来开始做官网的文档页 返回阅读列表点击 这里 路由设计 先想想我们需要文档页通向哪些地方,这里直接给出我的设计: 所属 子标题 跳转路径 文件名(*.vue) 指南 介绍 /do ...
- 06 - Vue3 UI Framework - Dialog 组件
做完按钮之后,我们应该了解了遮罩层的概念,接下来我们来做 Dialog 组件! 返回阅读列表点击 这里 需求分析 默认是不可见的,在用户触发某个动作后变为可见 自带白板卡片,分为上中下三个区域,分别放 ...
- 08 - Vue3 UI Framework - Input 组件
接下来再做一个常用的组件 - input 组件 返回阅读列表点击 这里 需求分析 开始之前我们先做一个简单的需求分析 input 组件有两种类型,即 input 和 textarea 类型 当类型为 ...
- 09 - Vue3 UI Framework - Table 组件
接下来做个自定义的表格组件,即 table 组件 返回阅读列表点击 这里 需求分析 开始之前我们先做一个简单的需求分析 基于原生 table 标签的强语义 允许用户自定义表头.表体 可选是否具有边框 ...
- 10 - Vue3 UI Framework - Tabs 组件
标签页是非常常用的组件,接下来我们来制作一个简单的 Tabs 组件 返回阅读列表点击 这里 需求分析 我们先做一个简单的需求分析 可以选择标签页排列的方向 选中的标签页应当有下划线高亮显示 切换选中时 ...
随机推荐
- asp.net中挺高性能的24种方法
那性能问题到底该如何解决?以下是应用系统发布前,作为 .NET 开发人员需要检查的点. 1.debug=「false」 当创建 ASP.NET Web应用程序,默认设置为「true」.开发过程中,设置 ...
- MySQL统计总数就用count(*),别花里胡哨的《死磕MySQL系列 十》
有一个问题是这样的统计数据总数用count(*).count(主键ID).count(字段).count(1)那个效率高. 先说结论,不用那么花里胡哨遇到统计总数全部使用count(*). 但是有很多 ...
- 配置Google支付相关参数(client_id, client_secret, refresh_token)
1. 登陆Google开发者账号,点击左边API权限 Google控制台 创建新项目 转到 Google Play 管理中心的 API 权限页面. 接受<服务条款>. 点击创建新项目. 系 ...
- 菜鸡的Java笔记 开发支持类库
开发支持类库 SupportClassLibrary 观察者设计模式的支持类库 content (内容) 什么是观察者设计模式呢? ...
- MySQl安装图形界面
对于mysql的图形界面有很多个:1.MySQL GUI Tools MySQL GUI Tools是一个可视化界面的MySQL数据库管理控制台,提供了四个非常好用的图形化应用程序,方便数据库管理和数 ...
- [bzoj3038]上帝造题的7分钟2
考虑每一个位置最多开6次左右就会变成1,然后操作就没有意义了,因此对线段树维护区间和和一个标记,表示是否全部都是1,然后对于修改,如果区间标记不是1就暴力下去,是1就不用操作,复杂度为$o(6nlog ...
- Nocalhost 为 KubeSphere 提供更强大的云原生开发环境
作者简介 张海立(驭势科技云平台研发总监):开源爱好者,云原生社区上海站 PMC 成员,KubeSphere Ambassador:日常云原生领域工作涉及 Kubernetes.DevOps.可观察性 ...
- Atcoder Regular Contest 072 C - Alice in linear land(思维题)
Atcoder 题面传送门 & 洛谷题面传送门 首先求出 \(s_i\) 表示经过 \(i\) 次操作后机器人会位于什么位置,显然 \(s_0=D\),\(s_i=\min(s_{i-1},| ...
- P3438 [POI2006]ZAB-Frogs
P3438 [POI2006]ZAB-Frogs 给出一个不一样的解法.不需要用到斜率优化等高级算法. 下文记 \(n=w_x,m=w_y\). 首先,答案显然满足可二分性,因此二分答案 \(d\in ...
- CF1156F Card Bag
题目传送门. 题意简述:有 \(n\) 张卡牌,每张卡牌有数字 \(a_1,a_2,\cdots,a_n\).现在随机抽取卡牌,不放回,设本次抽到的卡牌为 \(x\),上次抽到的卡牌为 \(y\),若 ...