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

律师做网站有用运用搜索引擎营销的案例

律师做网站有用,运用搜索引擎营销的案例,江门网站快速排名,泉州 网站制作类似京东商品详情-点击顶部详情跳转到页面对应的详情区域,点击评价跳转到页面对应的评价区域等。 照例,先封装方法: 封装方法 util.js /*** 锚点跳转(如:商品详情页面跳转)* param {string} targetId 目…

类似京东商品详情-点击顶部详情跳转到页面对应的详情区域,点击评价跳转到页面对应的评价区域等。

照例,先封装方法:

封装方法

util.js

/*** 锚点跳转(如:商品详情页面跳转)* @param {string} targetId 目标id* @param {string} rootId 外层盒子根id*/
export const goByAnchor = (targetId, rootId) => {if (targetId) {uni.createSelectorQuery().select('#' + targetId).boundingClientRect(data => {// 目标位置节点 类或者 iduni.createSelectorQuery().select("#" + rootId).boundingClientRect(res => {// 最外层盒子节点类或者 iduni.pageScrollTo({duration: 300, // 过渡时间  scrollTop: data.top - res.top - 88, // 到达距离顶部的top值})}).exec()}).exec();} else {uni.pageScrollTo({scrollTop: 0,duration: 300});}
}/*** 获取当前元素的一些info,如:距离顶部的距离*/
export const getElementInfoById = (elementId) => {return new Promise((resolve) => {uni.createSelectorQuery().select('#' + elementId).boundingClientRect(data => {resolve(data)}).exec()})
}

页面调用

<view class="goods-detail" id="goods-detail">
<!-- 顶部导航 -->
<uni-nav-bar left-icon="back" fixed statusBar :border="false" :backgroundColor="navBg" class="custom-nav" @clickLeft="pageBack"><template v-if="navBg == '#fff'"><view class="nav-title flex-around-center"><text :class="{ 'active-nav-title': !navTab }" @click="handleAnchor()">宝贝</text><text :class="{ 'active-nav-title': navTab == 'goodsStand' }" @click="handleAnchor('goodsStand')">规格</text><text :class="{ 'active-nav-title': navTab == 'goodsEvaluation' }" @click="handleAnchor('goodsEvaluation')">评价</text><text :class="{ 'active-nav-title': navTab == 'goodsDetail' }" @click="handleAnchor('goodsDetail')">商品详情</text></view></template>
</uni-nav-bar>
<!-- 其他内容 --><!-- 规格 -->
<view class="goods-stand" id="goodsStand">
<!-- 内容 -->
</view><!-- 评价 -->
<view class="goods-evaluation" id="goodsEvaluation">
<!-- 内容 -->
</view><!-- 商品详情 -->
<view class="img-list" id="goodsDetail">
<!-- 内容 -->
</view></view>
data() {return {navBg: 'rgba(0, 0, 0, .05)', // 顶部导航栏的背景色navTab: '', // 顶部导航的tab标识}
},
// 这里通过页面生命周期监听滚动条的位置,对应的回显高亮tab
onPageScroll(e) {if (e.scrollTop > 0) {this.navBg = '#fff'getElementInfoById('goodsStand').then((res) => {if (res.top < 88) {this.navTab = 'goodsStand'}})getElementInfoById('goodsEvaluation').then((res) => {if (res.top < 88) {this.navTab = 'goodsEvaluation'}})getElementInfoById('goodsDetail').then((res) => {if (res.top < 88) {this.navTab = 'goodsDetail'}})} else {this.navTab = ''this.navBg = 'rgba(0, 0, 0, .05)'}
},
methods: {// 锚点跳转handleAnchor(type) {this.navTab = typegoByAnchor(type, 'goods-detail')},
}
http://www.ds6.com.cn/news/116463.html

相关文章:

  • 设计类比赛网站东莞网站推广软件
  • 深圳网站建设骏域网站建设南京百度推广优化
  • 做信息图的免费网站游戏推广拉人渠道
  • 顺德手机网站设计价位小红书信息流广告
  • 邓州做网站seo要点
  • 制作一个私人网站怎么申请域名郑州网络营销推广
  • 呼和浩特企业网站制作百度普通下载
  • 收集链接 做网站凡科建站官网免费注册
  • 百度竞价网站源码百度相册登录入口
  • 临沂城乡建设管理局网站免费的网站申请
  • 网站域名到期不续费会怎么样引流推广营销
  • 网站建设的设备口碑营销方案
  • 苏州做企业网站网页生成器
  • 怎么做套板网站北京官网优化公司
  • 江西赣州疫情防控最新政策网站关键词快速优化
  • 做网站要不要钱宁波seo整体优化公司
  • 舟山普陀区建设局网站病毒式营销的案例
  • 两学一做党员夜校播放网站徐州seo外包
  • 怎么提升网站的排名头条搜索是百度引擎吗
  • wordpress 随机展示太原seo快速排名怎么样
  • 如何做公司介绍视频网站网络营销渠道有哪几种
  • 广州市人民政府网站关键词优化步骤简短
  • wordpress function.php 在哪里青岛网站seo服务
  • wordpress配合七牛云太原关键词排名优化
  • 网站和网页的区别是什么seo外包大型公司
  • wordpress 党建 主题南京seo公司哪家
  • 网站一般用什么软件做的网站访问量排行榜
  • 荔湾区建设局网站百度推广多少钱一天
  • 网站建设总结 优帮云百度url提交
  • app网站制作做营销怎样才能吸引客户