element-plus/website/pages/index.vue

438 lines
8.4 KiB
Vue
Raw Normal View History

<template>
<div>
<div class="banner">
<div class="banner-desc">
<h1>{{ langConfig[1] }}</h1>
<p>{{ langConfig[2] }}</p>
</div>
</div>
<div ref="indexMainImg" class="jumbotron">
<img src="~examples/assets/images/theme-index-blue.png" alt="" />
<div
class="jumbotron-red"
:style="{
height: mainImgOffset + 'px',
}"
>
<img src="~examples/assets/images/theme-index-red.png" alt="" />
</div>
</div>
<div class="sponsors">
<a
class="sponsor"
href="https://bit.dev/?from=element-ui"
target="_blank"
>
<img width="45" src="~examples/assets/images/bit.svg" alt="bit" />
<div>
<p>{{ sponsorLabel }} <span class="name">bit</span></p>
<p>Share Code</p>
</div>
</a>
2021-07-22 19:24:00 +08:00
<a
class="sponsor renren"
href="https://www.renren.io/?from=element-ui"
target="_blank"
>
<img width="45" src="~examples/assets/images/renren.png" alt="bit" />
2021-07-22 19:24:00 +08:00
<div>
<p>
{{ sponsorLabel }} <span class="name">{{ sponsorNameR }}</span>
</p>
2021-07-22 19:24:00 +08:00
<p>{{ sponsorIntroR }}</p>
</div>
</a>
</div>
<div class="cards">
<ul class="container">
<li>
<div class="card">
<img src="~examples/assets/images/guide.png" alt="" />
<h3>{{ langConfig[3] }}</h3>
<p>{{ langConfig[4] }}</p>
<router-link
active-class="active"
:to="`/${lang}/guide/design`"
exact
>
{{ langConfig[5] }}
</router-link>
</div>
</li>
<li>
<div class="card">
<img src="~examples/assets/images/component.png" alt="" />
<h3>{{ langConfig[6] }}</h3>
<p>{{ langConfig[7] }}</p>
<router-link
active-class="active"
:to="`/${lang}/component/layout`"
exact
>
{{ langConfig[5] }}
</router-link>
</div>
</li>
<li>
<div class="card">
<img src="~examples/assets/images/resource.png" alt="" />
<h3>{{ langConfig[8] }}</h3>
<p>{{ langConfig[9] }}</p>
<router-link active-class="active" :to="`/${lang}/resource`" exact>
{{ langConfig[5] }}
</router-link>
</div>
</li>
</ul>
</div>
</div>
</template>
<script>
import pageLang from '../i18n/page.json'
2020-08-31 15:18:02 +08:00
import { throttle } from 'throttle-debounce'
export default {
data() {
return {
lang: this.$route.meta.lang,
mainImgOffset: 0,
}
},
computed: {
sponsorLabel() {
return this.lang === 'zh-CN' ? '赞助商' : 'Sponsored by'
},
2021-07-22 19:24:00 +08:00
sponsorIntroR() {
return this.lang === 'zh-CN'
? '企业级的快速开发平台'
: 'Rapid development platform'
2021-07-22 19:24:00 +08:00
},
sponsorNameR() {
return this.lang === 'zh-CN' ? '人人开源' : 'renren.io'
},
langConfig() {
return pageLang.filter((config) => config.lang === this.lang)[0].pages
.index
},
},
created() {
this.throttledHandleScroll = throttle(10, true, (index) => {
this.handleScroll(index)
})
},
beforeUnmount() {
const dom = document.querySelector(
'#app>.el-scrollbar>.el-scrollbar__wrap.el-scrollbar__wrap--hidden-default'
)
dom.removeEventListener('scroll', this.throttledHandleScroll)
},
mounted() {
const dom = document.querySelector(
'#app>.el-scrollbar>.el-scrollbar__wrap.el-scrollbar__wrap--hidden-default'
)
dom.addEventListener('scroll', this.throttledHandleScroll)
},
methods: {
handleScroll() {
const ele = this.$refs.indexMainImg
const rect = ele.getBoundingClientRect()
const eleHeight = ele.clientHeight + 55
let calHeight = (180 - rect.top) * 2
if (calHeight < 0) calHeight = 0
if (calHeight > eleHeight) calHeight = eleHeight
this.mainImgOffset = calHeight
},
},
}
</script>
<style lang="scss" scoped>
.banner {
text-align: center;
}
.banner-desc {
padding-top: 30px;
h1 {
font-size: 34px;
margin: 0;
line-height: 48px;
color: #555;
}
p {
font-size: 18px;
line-height: 28px;
color: #888;
margin: 20px 0 5px;
}
}
.sponsors {
display: flex;
justify-content: center;
}
.sponsor {
margin: 0 20px 50px;
display: inline-flex;
width: 300px;
height: 100px;
justify-content: center;
2021-07-22 19:24:00 +08:00
align-items: center;
.name {
font-weight: bold;
color: var(--el-text-color-regular);
}
img {
margin-right: 20px;
}
div {
display: flex;
flex-direction: column;
justify-content: center;
}
p {
margin: 0;
line-height: 1.8;
color: var(--el-text-color-secondary);
font-size: 14px;
}
}
.jumbotron {
width: 890px;
margin: 30px auto;
position: relative;
img {
width: 100%;
}
.jumbotron-red {
transition: height 0.1s;
background: #fff;
position: absolute;
left: 0;
top: 0;
overflow: hidden;
}
}
.cards {
margin: 0 auto 110px;
width: 1140px;
.container {
padding: 0;
margin: 0 -11px;
width: auto;
&::before,
&::after {
display: table;
content: '';
}
&::after {
clear: both;
}
}
li {
width: 33.3%;
padding: 0 19px;
box-sizing: border-box;
float: left;
list-style: none;
}
img {
width: 160px;
height: 120px;
}
}
.card {
height: 430px;
width: 100%;
background: #ffffff;
border: 1px solid var(--el-border-color-base);
border-radius: 5px;
box-sizing: border-box;
text-align: center;
position: relative;
transition: all 0.3s ease-in-out;
bottom: 0;
img {
margin: 66px auto 60px;
}
h3 {
margin: 0;
font-size: 18px;
color: #1f2f3d;
font-weight: normal;
}
p {
font-size: 14px;
color: #99a9bf;
padding: 0 25px;
line-height: 20px;
}
a {
height: 53px;
line-height: 52px;
font-size: 14px;
color: #409eff;
text-align: center;
border: 0;
border-top: 1px solid var(--el-border-color-base);
padding: 0;
cursor: pointer;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
background-color: #fff;
border-radius: 0 0 5px 5px;
transition: all 0.3s;
text-decoration: none;
display: block;
&:hover {
color: #fff;
background: #409eff;
}
}
&:hover {
bottom: 6px;
box-shadow: 0 6px 18px 0 rgba(232, 237, 250, 0.5);
}
}
@media (max-width: 1140px) {
.cards {
width: 100%;
.container {
width: 100%;
margin: 0;
}
}
.banner .container {
width: 100%;
box-sizing: border-box;
}
.banner img {
right: 0;
}
}
@media (max-width: 1000px) {
.banner .container {
img {
display: none;
}
}
.jumbotron {
display: none;
}
}
@media (max-width: 768px) {
.cards {
li {
width: 80%;
margin: 0 auto 20px;
float: none;
}
.card {
height: auto;
padding-bottom: 54px;
}
}
.banner-stars {
display: none;
}
.banner-desc {
#line2 {
display: none;
}
h2 {
font-size: 32px;
}
p {
width: auto;
}
}
}
.theme-intro-b {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 200;
.intro-banner {
position: absolute;
}
img {
width: 300px;
}
.title {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
color: #fff;
text-align: center;
font-weight: bold;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
p {
padding: 0;
margin: 10px 0;
}
}
}
.theme-intro-a {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 200;
.mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: #000;
opacity: 0.5;
}
.intro-banner {
top: 50%;
left: 50%;
position: fixed;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
box-sizing: border-box;
text-align: center;
z-index: 100;
img {
width: 100%;
}
.intro-text {
position: absolute;
top: 50%;
left: 0;
right: 0;
p {
padding: 0;
margin: 0;
font-size: 48px;
font-weight: bold;
color: #fff;
}
}
}
}
</style>