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

网站定制建设哪里好百度风云排行榜官网

网站定制建设哪里好,百度风云排行榜官网,wordpress商城实战教程,怎么在网站中搜索关键字书接上回 上一次在文章中,我们讲解了Vue前端的容器搭建,在本文中,我们将继续细化设计,逐步完成一个较为完善的导航栏。 组件引用 组件引用是为了在较大规模开发时避免代码塞在一个文件里边,增加可读性。 在引用的主…

书接上回

上一次在文章中,我们讲解了Vue前端的容器搭建,在本文中,我们将继续细化设计,逐步完成一个较为完善的导航栏。

组件引用

组件引用是为了在较大规模开发时避免代码塞在一个文件里边,增加可读性。

在引用的主文件里的 js部分import,然后直接在 tmplate部分调用即可,代码如下

<template><div><navigator></navigator></div>
</template><style scoped></style><script setup>
// 导入组件
import navigator from "@/page/navigator/navigator.vue"
</script>

在需要被调用的组件中,记得一定要有<script setup>部分

<template><div class="navigator"></div>
</template><style scoped></style><script setup></script>

 调试浏览器,发现调用成功

导航栏框架搭建

这里提供一个简单的导航栏框架设计,本文将详细讲解微调过程。

先展示初版效果

提几个要点:

  1. 导航栏可以做个下端阴影,这样就算全白也会有区分度,看起来比较舒服
  2. 搜索框的border可以粗一点弄成圆的,用的element-plus组件所以需要使用::deep贯穿

<template><div class="navigator"><div class="logo"><img src="../../asset/board/logo.png" style="height:400%;margin-top: -21%;margin-left: 15%;user-select: none;"></div><div class="search"><el-inputv-model="keyword"placeholder="请输入搜索内容"suffix-icon="Search"class="round-input"style="width:100%; height:60%; margin-top:3%"></el-input></div><div class="selectionSet"><el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" style="margin-top: 3%;margin-left: 10%"><el-tab-pane label="首页" name="first">    </el-tab-pane><el-tab-pane label="资料库" name="second">  </el-tab-pane><el-tab-pane label="讨论区" name="third">   </el-tab-pane><el-tab-pane label="收藏夹" name="fourth">  </el-tab-pane></el-tabs><img src="../../asset/board/碳治郎1.png"style="height:90%;margin-left: 10%;margin-top: 0.5%"></div></div>
</template><style scoped>
.navigator {display: flex;align-items: center;/* background-color: #d5e4f4;*/background-color: #ffffff;height: 9%;/* 添加底部阴影效果 */box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}.logo {width: 30%;height: 100%;display: flex;padding-left: 3%;
}.search {display: flex;width: 30%;height: 100%;
}:deep(.round-input .el-input__wrapper) {border-radius: 20px !important;background-color: #FFFFFF;box-shadow: 0 0 0 1.5px rgb(210, 203, 241) !important;
}.selectionSet {display: flex;width: 40%;height: 100%;
}:deep(.el-tabs__item) {color: #000000;font-size: 25px;transition: color 0.3s ease;
}::v-deep .el-tabs__active-bar {background-color: #064fe1 !important;
}:deep(.el-tabs__nav-wrap::after) {position: static !important;
}
</style><script setup>
import { ref } from 'vue';const keyword = ref('');
const activeName = ref('first');const handleClick = (tab) => {console.log(' 当前选中标签:', tab.name);
};
</script>

图片文字取消点击光标闪烁

比如点击右上tab,发现光标是闪烁的,看的很不舒服,这里可以内联为元素设置一下

之后就不可选中了,图像貌似不可以这样解决,可以给图像设计一个点击跳转或点击放大,就不会出现光标闪烁了

user-select: none

输入框偏斜

如题所示,解决方案为在外边包的div上设置user-select:none ;这个偏斜实际上是选中了这个div

输入框悬停和聚焦流光动画

以下展示为全代码,方便CV

<template><div class="navigator"><div class="logo"><img src="../../asset/board/logo.png" style="height:100%;margin-left: 20%;"></div><div class="search"><el-inputv-model="keyword"placeholder="                                     biuuuu~ 灵 光 乍 现"suffix-icon="Search":class="{ 'round-input':true,'animated-placeholder': isSearchHover,'is-focused': isFocused  }"style="width:100%; height:60%; margin-top:3%"@focus="handleFocus"@blur="handleBlur"></el-input></div><div class="selectionSet"><el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" style="margin-top: 3%;margin-left: 13%"><el-tab-pane label="首页" name="first">    </el-tab-pane><el-tab-pane label="资料库" name="second">  </el-tab-pane><el-tab-pane label="讨论区" name="third">   </el-tab-pane><el-tab-pane label="收藏夹" name="fourth">  </el-tab-pane></el-tabs><img src="../../asset/board/碳治郎1.png"style="height:90%;margin-left: 10%;margin-top: 0.5%;user-select: none;"></div></div>
</template><style scoped>
.navigator {display: flex;align-items: center;background-color: #ffffff;height: 9%;/* 添加底部阴影效果 */box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}.logo {width: 30%;height: 100%;display: flex;padding-left: 3%;
}.search {display: flex;width: 30%;height: 100%;user-select: none;
}:deep(.round-input .el-input__wrapper) {border-radius: 20px !important;background-color: #FFFFFF;box-shadow: 0 0 0 1.5px rgb(210, 203, 241) !important;
}.selectionSet {display: flex;width: 40%;height: 100%;
}:deep(.el-tabs__item) {color: #000000;font-size: 20px;transition: color 0.4s ease;user-select: none;
}::v-deep .el-tabs__active-bar {background-color: rgb(2, 90, 255) !important;
}:deep(.el-tabs__nav-wrap::after) {position: static !important;
}@keyframes placeholderSlide {0% { transform: translateX(0); opacity: 0.6 }100% { transform: translateX(-10px); opacity: 0.2 }
}:deep(.round-input .el-input__wrapper) {transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 平滑过渡 */
}/* 悬停状态增强 */
:deep(.round-input:hover .el-input__wrapper) {box-shadow: 0 0 0 2px rgba(2, 90, 255, 0.3) !important;transform: scale(1.02);
}/* 聚焦状态动画 */
:deep(.round-input.is-focused  .el-input__wrapper) {box-shadow: 0 0 0 3px rgba(2, 90, 255, 0.2) !important;background-color: #f8f9fa;
}/* 动态placeholder动画 */
.animated-placeholder::placeholder {font-size: 14px;transition: all 0.3s ease;text-align: center;
}/* 悬停时placeholder动画 */
:deep(.round-input:hover) .animated-placeholder::placeholder {animation: placeholderSlide 0.8s infinite alternate;text-align: left;padding-left: 28px;
}/* 聚焦时placeholder消失动画 */
:deep(.round-input:focus-within) .animated-placeholder::placeholder {opacity: 0;transform: translateX(20px);transition: all 0.2s ease;
}
@keyframes streaming-light {0% { background-position: 0% 50%; }50% { background-position: 100% 50%; }100% { background-position: 0% 50%; }
}/* 流光容器 */
:deep(.round-input) .el-input__wrapper {position: relative;overflow: hidden;transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}/* 流光伪元素 */
:deep(.round-input) .el-input__wrapper::after {content: '';position: absolute;top: -2px;left: -2px;right: -2px;bottom: -2px;background: linear-gradient(45deg,rgba(2,90,255,0.1) 0%,rgba(255,255,255,0.8) 25%,rgba(2,90,255,0.3) 50%,rgba(255,255,255,0.8) 75%,rgba(2,90,255,0.1) 100%);background-size: 400% 400%;opacity: 0;z-index: 1;transition: opacity 0.8s ease;pointer-events: none;border-radius: 22px;
}/* 触发动画的条件 */
:deep(.round-input.is-focused)  .el-input__wrapper::after,
:deep(.round-input:hover) .el-input__wrapper::after {opacity: 1;animation: streaming-light 8s linear infinite;
}/* 输入框内容层提升层级 */
:deep(.el-input__inner) {position: relative;z-index: 2;background: transparent !important;
}
</style><script setup>
import { ref } from 'vue';let isSearchHover=ref(false);
let isFocus=ref(false);
const keyword = ref('');
const activeName = ref('first');const isFocused = ref(false);const handleFocus = () => {isFocused.value  = true;
};
const handleBlur = () =>
{isFocused.value  = false;
};
</script>

总结

本文中实现了一个前端代码比较完善的Nav开发,展示了各种可能遇到的问题,希望能对读者有所帮助

http://www.dtcms.com/wzjs/369197.html

相关文章:

  • 美食网站界面设计白杨seo
  • 专门做别墅的网站跨国网站浏览器
  • 网站建设中 模板素材发广告去哪个平台
  • 江西专业南昌网站建设焦作seo推广
  • 个人开网站泉州排名推广
  • ps切片以后 怎么做网站网页制作接单
  • 网站后台如何做色盲测试图
  • 门户网站开发用什么框架好做网站优化的公司
  • 廊坊市建设局网站深圳谷歌seo推广
  • 网站建设有没有资质南京今日新闻头条
  • 腾讯云网站搭建教程网页生成app
  • 正规的大连网站建设沈阳今天刚刚发生的新闻
  • 上海网站制作网站开发seo推广需要多少钱
  • 哪些网站做的人比较少seo的优化步骤
  • 了解网站建设管理制作链接的app的软件
  • 网站如何添加百度地图正规代运营公司
  • 厦门建设局网站商品房拉新推广怎么快速拉人
  • 企业级网站开发与部署企业网络营销案例分析
  • 网站制作如何做seo积分系统
  • 有好点的做网站的公司吗行者seo
  • 昆明网站建设一条龙服务加拿大搜索引擎
  • 做热点链接的网站十大免费域名
  • 电子网站建设心得seo优化有哪些
  • 个人网站建设基本流程网盟推广
  • 垃圾邮件网站百度app推广方法
  • 母婴会所 网站源码肇庆网站搜索排名
  • 福清手机网站建设谷歌优化方法
  • 网站建设一年多少钱站长平台
  • 网上做兼职的网站注册网站域名
  • 行业门户网站如何做郑州互联网公司排名