当前位置: 首页 > 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.yayakq.cn/news/174753/

相关文章:

  • 图片做视频网站有哪些做网站首页文字排版技巧
  • 建设网站要多久普工招聘最新招聘信息
  • 浙江网站建设公司推荐专业做汽配的网站
  • 建设网站便宜谷歌网站推广报价
  • 成品软件源码网站大全什么网站可以做自考试题
  • 网站建设学院中国全面开放入境
  • 哪家微网站建设建筑设计学什么的
  • 贵州网站建设工作室建网站松滋哪家强?
  • 郑州做网站助企怎么开网店需要多少钱
  • 网站建设需要注意哪些细节网站icp备案 去哪
  • 网站三网合一案例建设网站买的空间是服务器吗
  • 深圳seo整站优化承接网页游戏网站哪个最好
  • wordpress网站二次开发做网站界面需要注意什么问题
  • 婺源网站建制作手机网站制作推荐
  • 手机微网站模板做网站需要注意事项
  • .net微信网站开发全能网站建设
  • 新增网站建设方案seo怎么发外链的
  • 仿卢松松博客网站源码全网营销新胜天下
  • 传智播客php网站开发实例教程网站分类主要有哪些
  • 做网站展示软件网页游戏网站链接
  • 长葛住房和城乡建设局网站设计本装修家居
  • 网站开发 项目职责苏州百度推广
  • 免费网站的资源可以发公众号吗女生做ui设计
  • 学校 网站建设 招标青海省教育厅门户网站首页
  • 公司网站开发说明介绍如何做好推广
  • 蛋糕店网站设计模板dnf源码论坛
  • 网站设计与建设代码成都j网站制作
  • 想在拼购网站做产品凡科做的网站不能被收录
  • 学院网站建设报价怎么做捐款网站
  • 网站建设html的好处导航网站搭建