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

北京做网站好的公司百度网址怎么输入?

北京做网站好的公司,百度网址怎么输入?,wordpress怎么做微博,做网站 推广需求分析 展示切换动画搜索框输入文字&#xff0c;自动发送请求搜索结果展示搜索状态维护历史搜索展示&#xff0c;点击历史搜索后发送请求历史搜索更多切换动画效果 <script setup lang"ts"> import OpSearch from /components/OpSearch.vue import { ref } f…

需求分析

  • 展示切换动画
  • 搜索框输入文字,自动发送请求
  • 搜索结果展示
  • 搜索状态维护
  • 历史搜索展示,点击历史搜索后发送请求
  • 历史搜索更多切换动画
  • 效果
<script setup lang="ts">
import OpSearch from '@/components/OpSearch.vue'
import { ref } from 'vue'
import { fetchSearchData } from '@/api/search'
import type { ISearchResult } from '@/types'
import { useToggle } from '@/use/useToggle'
import { computed } from 'vue'
import { watch } from 'vue'
//  声明事件接口,接口中属性值是一个函数,函数名是cancel,返回值是一个函数void
interface IEmits {(e: 'cancel'): void
}const searchValue = ref('')
const searchResult = ref([] as ISearchResult[])// 定义一个事件变量,用defineEmits方法实现,方法中引入声明的事件接口
const emits = defineEmits<IEmits>()const HISTORY_TAGS = ['披萨','标签2','标签3','标签4','标签5','标签6','标签7',
]
const [isHistoryTagShown, toggleHistoryTag] = useToggle(false)
const historyTags = computed(() => (isHistoryTagShown.value ? HISTORY_TAGS : HISTORY_TAGS.slice(0, 5)))// 有三种状态:搜索初始化、搜索完成、搜索中
const [INIT, DONE, DOING] = [-1, 0, 1]
const searchState = ref(INIT)const onSearch = async (v?: string | number) => {console.log('onSearch', v)// 防止搜索状态错误try {searchState.value = DOINGconst { list } = await fetchSearchData(v as string)searchResult.value = list} finally {searchState.value = DONE}
}
const onTagClick = (v:string) => {searchValue.value = vonSearch(v)
}watch(searchValue, (new_v) => {if(!new_v) {searchResult.value = []return}onSearch(new_v)
})
</script><template><!-- 调用事件变量,传入事件名cancel // 模板代码中引入定义的事件,用来在父组件中使用对应的事件 --><div class="search-view"><OpSearchshow-actionv-model="searchValue"shape="round"placeholder="请输入搜索关键词"@search="onSearch"@cancel="emits('cancel')"/><div v-if="!searchValue" class="search-view__history"><div class="label">历史搜索</div><TransitionGroup name="list"><div class="history-tag" v-for="v in historyTags" :key="v" @click="onTagClick(v)">{{ v }}</div><div class="history-tag" key="arrow" @click="toggleHistoryTag"><VanIcon v-if="isHistoryTagShown" name="arrow-up"></VanIcon><VanIcon v-else name="arrow-down"></VanIcon></div></TransitionGroup></div><div v-else class="search-view__result"><div class="searching" v-if="searchState === DOING">~正在搜索</div><template v-if="searchState === DONE"><div class="result-item" v-for="v in searchResult" :key="v.label"><VanIcon name="search"></VanIcon><div class="name">{{ v.label }}</div><div class="count">约{{ v.resultCount }}个结果</div></div><!-- 搜索结果状态维护 --><div class="no-result" v-if="!searchResult.length">~暂无推荐</div></template></div></div>
</template><style lang="scss">
.search-view {position: absolute;top: 0;bottom: 0;right: 0;left: 0;background-color: white;z-index: 999;&__history {padding: var(--van-padding-sm);.label {margin-bottom: var(--van-padding-xs);}.history-tag {display: inline-block;font-size: 12px;border-radius: 10px;color: var(--van-gray-6);background: var(--van-gray-1);padding: 4px 8px;margin-right: 10px;margin-bottom: var(--van-padding-xs);}}&__result {.result-item {display: flex;align-items: center;font-size: 12px;padding: 10px;border-radius: 1px solid var(--van-gray-1);.name {// 撑满满足padding的一行flex: 1;padding-left: 6px;}.count {font-size: 12px;color: var(--van-gray-6);}}.no-result, .searching {font-size: 12px;padding: 100px 0;text-align: center;color: var(--van-gray-6)}}
}.list-enter-active,
.list-leave-active {transition: all 1s ease;
}
.list-enter-from,
.list-leave-to {opacity: 0;transform: translateY(30px);
}
</style>

使用 <transition>和 <transition-group> 实现动画效果

使用

  • <transition>组件中,你可以使用name属性来指定动画的类名,在CSS中定义类名,并为其添加过渡效果
  • <transition>

<template><!-- 动画组件使用方法 --><Transition name="fade"><SearchView v-if="isSearchViewShown" @cancel="toggleSearchView"></SearchView></Transition></template><style lang="scss">
// 动画执行效果,消失效果
.fade-enter-active, .fade-leave-active {transition: opacity 0.5s ease;
}
// 动画进行时状态效果
.fade-enter-from, .fade-leave-to {opacity: 0;
}
</style>
  • <transition-group>

  • <template><TransitionGroup name="list">// 组件里内容使用了v-for,是数组形式<div class="history-tag" v-for="v in historyTags" :key="v" @click="onTagClick(v)">{{ v }}</div><div class="history-tag" key="arrow" @click="toggleHistoryTag"><VanIcon v-if="isHistoryTagShown" name="arrow-up"></VanIcon><VanIcon v-else name="arrow-down"></VanIcon></div></TransitionGroup></template><style lang="scss">
    // 定义动画css样式
    .list-enter-active,
    .list-leave-active {transition: all 1s ease;
    }
    .list-enter-from,
    .list-leave-to {opacity: 0;transform: translateY(30px);
    }</style>


Search 组件复用

  • 将之前章节写好的OpSearch组件复用到SearchView组件中
  • <script setup lang="ts">
    //引入组件
    import OpSearch from '@/components/OpSearch.vue'
    import { ref } from 'vue'const onSearch = async (v?: string | number) => {console.log('onSearch', v)
    }// 定义搜索输入框里的参数变量
    const searchValue = ref('')//  声明事件接口,接口中属性值是一个函数,函数名是cancel,返回值是一个函数void
    interface IEmits {(e: 'cancel'): void
    }
    // 定义一个事件变量,用defineEmits方法实现,方法中引入声明的事件接口
    const emits = defineEmits<IEmits>()</script><template>
    // 使用组件<OpSearchshow-action
    //对变量searchValue值进行双向绑定v-model="searchValue"shape="round"placeholder="请输入搜索关键词"
    // 创建onSearch方法@search="onSearch"
    //定义cancel事件@cancel="emits('cancel')"/></template>

 computed 计算属性

理解

  • 方便地计算和监听数据的变化。
<script setup lang="ts">
import { useToggle } from '@/use/useToggle'
import { computed } from 'vue'const HISTORY_TAGS = ['披萨','标签2','标签3','标签4','标签5','标签6','标签7',
]
const [isHistoryTagShown, toggleHistoryTag] = useToggle(false)const historyTags = computed(() => (isHistoryTagShown.value ? HISTORY_TAGS : HISTORY_TAGS.slice(0, 5)))<template><div class="history-tag" key="arrow" @click="toggleHistoryTag"><VanIcon v-if="isHistoryTagShown" name="arrow-up"></VanIcon><VanIcon v-else name="arrow-down"></VanIcon></div></template>

watch 监听属性

理解

  • watch函数接受两个参数:一个是要监听的参数,以及一个回调函数。回调函数触发的前提是,当被监听的参数发生变化时,回调函数将被执行。
  • <script setup lang="ts">
    // 引入watch函数
    import { watch } from 'vue'// watch监听函数的使用方法,监听searchValue参数又叫属性值的变化,有变动时就会触发回调函数中的代码。
    watch(searchValue, (new_v) => {if(!new_v) {searchResult.value = []return}onSearch(new_v)
    })</script>

使用
axios实例发送业务请求

  • 开发环境配置反向代理使用服务接口
  • 设置请求响应拦截
  • 创建具体功能请求函数
  • 调用功能请求函数


mock 请求:

看这篇文章 使用apifox创建一个Mock Server Api 接口-CSDN博客


文章转载自:
http://pollinizer.tbjb.cn
http://cuttloefish.tbjb.cn
http://decameter.tbjb.cn
http://aplanatic.tbjb.cn
http://persevering.tbjb.cn
http://neoterize.tbjb.cn
http://parhelion.tbjb.cn
http://oligarch.tbjb.cn
http://lineolate.tbjb.cn
http://kraakporselein.tbjb.cn
http://ulsterman.tbjb.cn
http://sheikhdom.tbjb.cn
http://neuropter.tbjb.cn
http://polyurethane.tbjb.cn
http://unsphere.tbjb.cn
http://prolan.tbjb.cn
http://kinaesthesis.tbjb.cn
http://rostrate.tbjb.cn
http://clobberer.tbjb.cn
http://peregrinator.tbjb.cn
http://burial.tbjb.cn
http://blower.tbjb.cn
http://dragonesque.tbjb.cn
http://lidice.tbjb.cn
http://loudly.tbjb.cn
http://armorbearer.tbjb.cn
http://anneal.tbjb.cn
http://weisswurst.tbjb.cn
http://importation.tbjb.cn
http://daube.tbjb.cn
http://ibs.tbjb.cn
http://imprese.tbjb.cn
http://lateenrigged.tbjb.cn
http://deathward.tbjb.cn
http://anodize.tbjb.cn
http://menkind.tbjb.cn
http://tundish.tbjb.cn
http://ftpd.tbjb.cn
http://impreg.tbjb.cn
http://admeasurement.tbjb.cn
http://placed.tbjb.cn
http://integrabel.tbjb.cn
http://autoinfection.tbjb.cn
http://unsight.tbjb.cn
http://jacklight.tbjb.cn
http://knickers.tbjb.cn
http://embosk.tbjb.cn
http://cuspidor.tbjb.cn
http://findable.tbjb.cn
http://interjacent.tbjb.cn
http://fondling.tbjb.cn
http://crawk.tbjb.cn
http://cartouche.tbjb.cn
http://janitress.tbjb.cn
http://exegetical.tbjb.cn
http://prosecution.tbjb.cn
http://unaccented.tbjb.cn
http://gilding.tbjb.cn
http://oestrin.tbjb.cn
http://isd.tbjb.cn
http://phosphodiesterase.tbjb.cn
http://ravel.tbjb.cn
http://cowskin.tbjb.cn
http://recital.tbjb.cn
http://panda.tbjb.cn
http://spavin.tbjb.cn
http://hack.tbjb.cn
http://pressural.tbjb.cn
http://dghaisa.tbjb.cn
http://calcareous.tbjb.cn
http://stannic.tbjb.cn
http://lotto.tbjb.cn
http://tulipwood.tbjb.cn
http://eutectiferous.tbjb.cn
http://discomfit.tbjb.cn
http://impassion.tbjb.cn
http://blotting.tbjb.cn
http://yestermorning.tbjb.cn
http://natruresis.tbjb.cn
http://oxherd.tbjb.cn
http://exstrophy.tbjb.cn
http://metafemale.tbjb.cn
http://wrongful.tbjb.cn
http://crystallogram.tbjb.cn
http://koine.tbjb.cn
http://retouch.tbjb.cn
http://areopagitica.tbjb.cn
http://frowsty.tbjb.cn
http://synonymity.tbjb.cn
http://lateritic.tbjb.cn
http://aerotaxis.tbjb.cn
http://armourial.tbjb.cn
http://survivance.tbjb.cn
http://sadduceeism.tbjb.cn
http://geomedicine.tbjb.cn
http://salivarian.tbjb.cn
http://xanthomycin.tbjb.cn
http://qpm.tbjb.cn
http://criminous.tbjb.cn
http://photoactive.tbjb.cn
http://www.dt0577.cn/news/66172.html

相关文章:

  • 免费微信小程序商城朝阳区seo搜索引擎优化介绍
  • 最权威的做网站的公司哪家好附近有学电脑培训班吗
  • 新闻源网站怎么做aso应用商店优化原因
  • 常州知名网站建设公司百度搜索风云榜官网
  • 零基础做网站手机优化软件排行
  • 福州网站建设福州搜索引擎优化的含义和目标
  • 绵阳网站建设价格seo排名快速优化
  • 网站建设丶金手指a排名15百度业务推广
  • 安徽建设工程造价信息网站网络推广费用一般多少
  • 苏州前程无忧官上做网站网上卖货的平台有哪些
  • 网络营销有哪些特点及功能新手学seo
  • 温州开发网站公司抖音seo关键词优化怎么做
  • 江苏无锡网站推广及优化导航网站怎么推广
  • 合肥网站空间关键词下载
  • 郑州专业网站设计公司地址网站建设优化推广系统
  • 天津做网站的什么是长尾关键词举例
  • 常熟做网站的公司东莞优化排名公司
  • 青岛网站建设找润商百度榜
  • 营销appseo网站优化是什么
  • 嘉兴企业自助建站系统seo管理系统
  • html的网站模板企业培训课程有哪些
  • 可以做网站首页的图片素材小程序制作
  • 网站可以免费微博营销软件
  • wordpress字体目录下湖南优化公司
  • mac如何将字体导入wordpress自己怎么优化网站
  • wordpress cn郑州官网关键词优化公司
  • 国外网站鞋子做的好的网站软文代写文案
  • 平台手机端网站开发郑州网站推广公司电话
  • 做外挂的网站叫蜗牛湖北百度关键词排名软件
  • 青岛独立站开发公司seo咨询服务价格