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

我有域名怎么做网站网站页面的优化

我有域名怎么做网站,网站页面的优化,免费注册网站是真的吗,国外做的好的鲜花网站简言 在工作时有时会用到竖形手风琴效果的组件。 在此记录下实现代码和实现思路。 手风琴实现 结构搭建 搭建结构主要实现盒子间的排列效果。 用flex布局或者其他布局方式将内容在一行排列把每一项的内容和项头用盒子包裹, 内容就是这一项要展示的内容&#xf…

简言

在工作时有时会用到竖形手风琴效果的组件。
在此记录下实现代码和实现思路。

手风琴实现

结构搭建

搭建结构主要实现盒子间的排列效果。

  • 用flex布局或者其他布局方式将内容在一行排列
  • 把每一项的内容和项头用盒子包裹, 内容就是这一项要展示的内容(content-box),项头就是可以点击显示这一项的盒子(title-box)。
  • 默认第一项的context-box显示,即有宽度,其他项的content-box宽度为0.
  • content-box加上过渡样式,这样就会有推拉的感觉。
  • 由于是vue组件,那我们可以给它加上插槽,让组件可以自定义显示内容

在这里插入图片描述

功能搭建

  • 点击项头显示 点击项的内容区域。由于我们已经将未显示的content-box宽度设为0,所以只需要添加一个变量将带有宽度的类样式赋给当前点击项即可显示。
  • 宽度变化时,里面的内容样式可能会发生改动,所以我们需要给内容里的box加一个透明度的过渡效果,避免样式发生改变试被看到。
  • 加插槽,插槽点随意,合理就行。
  • 加属性,例如,当前显示项、当前显示项内容等。

代码

<template><div class="accordion"><slot><div class="item__box" v-for="(item, i) of list" :key="i"><divclass="item__content":class="[`item__content${i}`, { 'item__content-active': activeIndex === i }]"><div class="item__content__detail"><slot :name="`item__content${i}`"> </slot></div></div><divclass="item__title":class="[`item__title${i}`, { 'item__title-active': activeIndex === i }]"><div class="item__title__detail" @click="() => tabChange(i)"><slot :name="`item__title${i}`"><imgv-if="!!item.icon":src="activeIndex === i ? getImageUrl(item.activeIcon  as string) : getImageUrl(item.icon)"alt=""/><div class="item__title__detail__text">{{ item.title }}</div></slot></div></div></div></slot></div>
</template>
<script lang="ts" setup>
import { reactive, toRefs, onBeforeMount, onMounted, ref } from 'vue'
import { getImageUrl } from '@/untils/index'interface Item {icon?: stringactiveIcon?: stringtitle: string
}defineProps({list: {type: Array<Item>,default: () => []}
})const activeIndex = ref(0)const tabChange = (index: number) => {activeIndex.value = index
}
</script>
<style lang="scss" scoped>
.accordion {position: relative;width: 1181px;height: 512px;display: flex;color: #fff;background: url('@/assets/images/bg_shoufq.png');overflow: hidden;
}
.item__box {position: relative;display: flex;overflow: hidden;margin-left: 4px;
}
.item__content {flex-shrink: 0;width: 0;left: 1000px;overflow: hidden;transition: all 0.5s ease;
}
.item__title {width: 110px;flex-shrink: 0;background: #00398e;
}
.item__content__detail {width: 842px;height: 512px;opacity: 0;transition: opacity 0.5s ease;
}
.item__content-active {width: 842px;left: 0;.item__content__detail {opacity: 1;}
}
.item__title__detail {display: flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;height: 512px;cursor: pointer;&__text {writing-mode: vertical-lr;height: 160px;font-size: 28px;font-family: PingFangSC-Semibold, PingFang SC;font-weight: 600;color: #ffffff;line-height: 40px;letter-spacing: 8px;}
}
.item__title-active {background: linear-gradient(180deg, #ffbb1a 0%, #f57c00 100%);
}@keyframes moveInRight {from {transform: translateX(100%);}to {transform: translateX(0);}
}
</style>

使用

<template><div class="container"><Accordion class="three__box__text" :list="dataOpenList"><template #item__content0><div class="edu__gaikuang">11</div></template><template #item__content1><div class="edu__gongbao">22</div></template><template #item__content2><div class="edu_nianjian">33</div></template></Accordion></div>
</template>
<script lang="ts" setup>
import { reactive, toRefs, onBeforeMount, onMounted } from 'vue'
import Accordion from '@/components/accordion.vue'const dataOpenList = reactive([{// icon: 'icon/icon_edu_gk.png',// activeIcon: 'icon/icon_edu_gk_active.png',title: '教育概况'},{// icon: 'icon/icon_edu_nb.png',// activeIcon: 'icon/icon_edu_nb_active.png',title: '教育公报'},{// icon: 'icon/icon_edu_nj.png',// activeIcon: 'icon/icon_edu_nj_active.png',title: '教育年鉴'}
])
</script>
<style lang="scss" scoped></style>

在这里插入图片描述
效果
在这里插入图片描述

结语

根据此思路,可以自己实现不同方向和不同排列方式的手风琴效果。

http://www.hkea.cn/news/225884/

相关文章:

  • 360应用商店seo服务套餐
  • 废橡胶网站建设个人博客网页设计
  • 什么网站做一手项目好域名查询官网
  • 做日用品的要找什么网站好站长工具端口检测
  • 贵州软件开发 网站开发手机版百度一下
  • 企业网站建立答辩问题百度怎么发布广告
  • 温州快建网站地推拉新接单网
  • 濉溪县城乡建设委员会燃气办网站热狗网站排名优化外包
  • 网站能不能自己做免费的seo教程
  • 湖南的商城网站建设优化教程网下载
  • 做网站需要哪些工程师西安seo诊断
  • tp做的网站封装成app2023北京封控了
  • 增城做网站要多少钱推广普通话手抄报
  • 石家庄网站系统开发智能搜索引擎
  • 迅速网站网络营销平台推广方案
  • 学前端要逛那些网站微信引流主动被加软件
  • 韩国flash网站免费手机网站建站平台
  • 东莞做网站卓诚网络昆明长尾词seo怎么优化
  • WordPress个性萌化插件郑州seo优化哪家好
  • 专业手机移动网站建设免费的seo优化
  • 西安网站建设王永杰域名注册 万网
  • 网站营销优化方案北京做的好的seo公司
  • 企业网站排名提升软件优化南宁seo优化
  • 创意合肥网站建设杭州seo公司排名
  • 网站专题页是什么中国十大关键词
  • 五月天做网站网络策划与营销
  • 高校网站如何建设论文谷歌官网下载
  • 做网站内容软件个人网站怎么做
  • 收废铁的做网站有优点吗海南百度推广开户
  • wordpress 二维码插件下载信阳搜索引擎优化