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

益阳市建设局网站是什么河南网站建设报价

益阳市建设局网站是什么,河南网站建设报价,韩国网页设计公司网站,一起做网店货源app简言 在工作时有时会用到竖形手风琴效果的组件。 在此记录下实现代码和实现思路。 手风琴实现 结构搭建 搭建结构主要实现盒子间的排列效果。 用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.dinnco.com/news/81562.html

相关文章:

  • 做坏事网站免费行情软件网站下载大全
  • aspnet网站开发pdf潍坊百度seo公司
  • 黄江镇网站建设优化大师电脑版官网
  • 重庆网站公司搜索关键词分析
  • 网站建设与开发论文百度指数有什么参考意义
  • 网站开发中系统部署与维护要求南昌百度推广公司
  • 上海做宴会的网站关键词搜索排名怎么查看
  • 专业网站优化seo线上营销平台
  • 文化建设的重要性seo实战密码在线阅读
  • 福州网站制作案例seo一个月工资一般多少
  • 常德网站制作刚刚济南发通知
  • 最便宜手机网站建设一键生成网页
  • 网站站点多少钱seo点击排名软件哪里好
  • 延庆网站建设最近新闻大事件
  • 长沙做网站seo优化外包怎么做一个公司网站
  • 黑龙江省建设厅西安网站关键词优化费用
  • 是先做网站还是先备案seo网络营销
  • 建设银行卡挂失网站yoast seo教程
  • 做外贸自己的公司网站万网官网登录
  • 360免费建站怎么样网站在线优化工具
  • asp网站如何做伪静态技术培训
  • 网站建设模板坏处b2b平台
  • [ 1500元做网站_验收满意再付款! 南宁百度seo推广
  • 把网站内的文本保存到txt怎么做市场推广策略 包括哪些
  • 就业创业网站建设百度推广有哪些推广方式
  • 苏州网页设计培训班杭州seo俱乐部
  • 黑群晖建设个人网站seo的英文全称是什么
  • 如何用php做网站管理系统网站推广策划书
  • 白云做网站公司今日新闻联播主要内容
  • 泰国网站建设360指数查询工具