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

网站开发优秀论文seo内容优化方法

网站开发优秀论文,seo内容优化方法,9377将军,淮安做网站app微信小程序实战系列 《微信小程序实战-01翻页时钟-1》 文章目录 微信小程序实战系列前言计时功能实现clock.wxmlclock.wxssclock.js 运行效果总结 前言 接着《微信小程序实战-01翻页时钟-1》,继续完成“6个页面的静态渲染和计时”功能。 计时功能实现 clock.wxm…

微信小程序实战系列

  • 《微信小程序实战-01翻页时钟-1》

文章目录

  • 微信小程序实战系列
  • 前言
  • 计时功能实现
    • clock.wxml
    • clock.wxss
    • clock.js
  • 运行效果
  • 总结

前言

接着《微信小程序实战-01翻页时钟-1》,继续完成“6个页面的静态渲染和计时”功能。

计时功能实现

clock.wxml

clock.wxml中 新增了wx:for(基础知识),用来现实六个“页面”;“item”相当于一个较大的盒子“包裹”着“flip_item”及其后代组件。“item”用来渲染时钟的四个“黑点”,flip_item用来渲染“页轴”。

<!--pages/clock/clock.wxml--><view class="container"><view class="clock_container"><block wx:for="{{timeArr}}" wx:for-index="timeIndex" wx:for-item="timeItem" wx:key="timeIndex"><view class="item"><view class="flip_item"><view class="up"><view class="number">{{timeItem}}</view></view><view class="down"><view class="number">{{timeItem}}</view></view></view></view></block></view>
</view>

clock.wxss

CSS中,::before::after都是创建一个伪元素(pseudo-element);::before为匹配选中的元素的第一个子元素;::after为已选中元素的最后一个子元素。通常会配合content属性来为该伪元素添加装饰内容。这个伪元素默认是行内元素。

CSS中,:nth-of-type() 创建一个伪类(pseudo-class),基于同类型元素(组件名称)的兄弟元素中的位置来匹配元素。

每段样式的作用在代码中都做了注释。

/* pages/clock/clock.wxss */
.clock_container{display: flex;
}/* 设置item的样式,固定宽高 */
.item {position: relative;width: 90rpx;height: 155rpx;border:1rpx solid rgba(121, 121, 121, 0.384);box-shadow: 0 4rpx 18rpx rgba(0,0,0,0.9);border-radius: 10rpx;margin-right: 12rpx;background-color: #55e3e3;
}.flip_item{position: relative;width: 100%;height: 100%;box-shadow: 0 4rpx 18rpx rgba(0,0,0,0.9);
}/* 第2、4页增加右边距 */
.item:nth-of-type(4),
.item:nth-of-type(2){margin-right: 48rpx;
}/* 第2、4页增点 “黑点” */
.item:nth-of-type(4)::before,
.item:nth-of-type(4)::after,
.item:nth-of-type(2)::before,
.item:nth-of-type(2)::after{position: absolute;content:'';width: 25rpx;height: 25rpx;background-color: rgba(0,0,0,0.8);border-radius: 50%;left: 105rpx;
}/* 增加 上“黑点”边距 */
.item:nth-of-type(4)::before,
.item:nth-of-type(2)::before{top: 30rpx;
}/* 增加 下“黑点”边距 */
.item:nth-of-type(4)::after,
.item:nth-of-type(2)::after{bottom: 30rpx;
}/* 时钟的单个数字 */
.number{position: absolute;/* border: 1px solid red; 调试用 */width: 100%;height: 155rpx;color: #252525;text-align: center;text-shadow: 0 2rpx 4rpx rgb(0, 0, 0);font-size: 118rpx;font-weight: bold;
}/* 页轴 */
.flip_item::before{position: absolute;content: '';top: 75rpx;width: 100%;height: 5rpx;background-color: rgba(0, 0, 0, 0.5);
}/*  掩盖“down”的上半部分 */
.down{position: absolute;width: 100%;height: 50%;overflow: hidden;bottom: 0;
}
.down .number{bottom: 0;
}/* 掩盖“up”的下半部分 */
.up{position: absolute;width: 100%;height: 50%;overflow: hidden;
}

clock.js

// pages/clock/clock.js
Page({/*** 页面的初始数据*/data: {timeArr:[]},/*** 获取时间数组*/getTimeArr: function(){let tempArr = []let str = ""let now = new Date()// 获取小时let hours = now.getHours()// console.log("hours", hours)str = hours.toString()if (str.length === 1){tempArr[0] = '0'tempArr[1] = str[1]}else{tempArr[0] = str[0]tempArr[1] = str[1]}// 获取分钟let minutes = now.getMinutes()// console.log("minutes", minutes)str = minutes.toString()if (str === '0'){tempArr[2] = '0'tempArr[3] = '0'}else if (str.length === 1){tempArr[2] = '0'tempArr[3] = str[0]}else{tempArr[2] = str[0]tempArr[3] = str[1]}// 获取秒数let seconds = now.getSeconds()// console.log("seconds", seconds)str = seconds.toString()if (str === '0'){tempArr[4] = '0'tempArr[5] = '0'}else if (str.length === 1){tempArr[4] = '0'tempArr[5] = str[0]}else{tempArr[4] = str[0]tempArr[5] = str[1]}this.setData({timeArr:tempArr})// console.log("timeArr:", this.data.timeArr)},/*** 设置定一个定时器, 每秒更新TimeArr*/timeRunner: function(){this.timer = setInterval(()=>{ //设置定时器this.getTimeArr()}, 1000)},/*** 生命周期函数--监听页面加载*/onLoad(options) {this.getTimeArr()this.timeRunner()},/*** 生命周期函数--监听页面初次渲染完成*/onReady() {},/*** 生命周期函数--监听页面显示*/onShow() {},/*** 生命周期函数--监听页面隐藏*/onHide() {},/*** 生命周期函数--监听页面卸载*/onUnload() {clearInterval(this.timer);},/*** 页面相关事件处理函数--监听用户下拉动作*/onPullDownRefresh() {},/*** 页面上拉触底事件的处理函数*/onReachBottom() {},/*** 用户点击右上角分享*/onShareAppMessage() {}
})

运行效果

请添加图片描述

说明:本文样式代码中的nth-of-type只能在WebView渲染模式下正常显示;在Skyline模式下,由于不支持“nth-of-type”,因此“小黑点”渲染不出来,后续Skyline是否支持“nth-of-type”可能只有天知道了!

请添加图片描述

总结

今天完成了三分之二的“翻页时钟”,下一篇博文将记录最后一个部分“动态翻页效果”。


文章转载自:
http://dinncoglycogen.zfyr.cn
http://dinncosemiography.zfyr.cn
http://dinncoraphia.zfyr.cn
http://dinncoincontrollably.zfyr.cn
http://dinncolivingly.zfyr.cn
http://dinncosolonetz.zfyr.cn
http://dinncoswimmer.zfyr.cn
http://dinncogenesic.zfyr.cn
http://dinncopurpoint.zfyr.cn
http://dinncoreinforcer.zfyr.cn
http://dinncoartichoke.zfyr.cn
http://dinncopomorze.zfyr.cn
http://dinncountransportable.zfyr.cn
http://dinncophallism.zfyr.cn
http://dinncojoyuce.zfyr.cn
http://dinncoinspectoscope.zfyr.cn
http://dinncoguanase.zfyr.cn
http://dinncostokehole.zfyr.cn
http://dinncowatchcase.zfyr.cn
http://dinncobenzocaine.zfyr.cn
http://dinncoponderability.zfyr.cn
http://dinncoassert.zfyr.cn
http://dinncosoar.zfyr.cn
http://dinncodibble.zfyr.cn
http://dinncochileanize.zfyr.cn
http://dinncobassoon.zfyr.cn
http://dinncoamaurosis.zfyr.cn
http://dinncoalbertine.zfyr.cn
http://dinncoterai.zfyr.cn
http://dinncofreckling.zfyr.cn
http://dinncopriestlike.zfyr.cn
http://dinncodarling.zfyr.cn
http://dinncochristendom.zfyr.cn
http://dinncophyllodium.zfyr.cn
http://dinncocake.zfyr.cn
http://dinncorehandle.zfyr.cn
http://dinncodelusively.zfyr.cn
http://dinncoscatophagous.zfyr.cn
http://dinncokohoutek.zfyr.cn
http://dinncooutspan.zfyr.cn
http://dinncodooda.zfyr.cn
http://dinncoexhilarating.zfyr.cn
http://dinncoaloha.zfyr.cn
http://dinncotonguy.zfyr.cn
http://dinncotankstand.zfyr.cn
http://dinncodietetical.zfyr.cn
http://dinncoensue.zfyr.cn
http://dinncotransitable.zfyr.cn
http://dinncopmkd.zfyr.cn
http://dinncoundulant.zfyr.cn
http://dinncobluenose.zfyr.cn
http://dinncocontranatant.zfyr.cn
http://dinncosulfonic.zfyr.cn
http://dinncopiemonte.zfyr.cn
http://dinncooutlearn.zfyr.cn
http://dinncoflagellate.zfyr.cn
http://dinncoquadripartite.zfyr.cn
http://dinncovirtuousness.zfyr.cn
http://dinncoplashy.zfyr.cn
http://dinncogroyne.zfyr.cn
http://dinncozambia.zfyr.cn
http://dinncobillingsgate.zfyr.cn
http://dinncoyeoman.zfyr.cn
http://dinncoseaplane.zfyr.cn
http://dinncodemiworld.zfyr.cn
http://dinncokcal.zfyr.cn
http://dinncophalange.zfyr.cn
http://dinncobandleader.zfyr.cn
http://dinncochromeplate.zfyr.cn
http://dinncoalgometer.zfyr.cn
http://dinncothermometer.zfyr.cn
http://dinncofrugivorous.zfyr.cn
http://dinncopreemption.zfyr.cn
http://dinncotrollpoy.zfyr.cn
http://dinncotophus.zfyr.cn
http://dinncoalveolus.zfyr.cn
http://dinncodyfed.zfyr.cn
http://dinncoundereducated.zfyr.cn
http://dinncocompelling.zfyr.cn
http://dinncoultracold.zfyr.cn
http://dinncodaresay.zfyr.cn
http://dinncophotooxidation.zfyr.cn
http://dinncogryke.zfyr.cn
http://dinncooverstowage.zfyr.cn
http://dinncobere.zfyr.cn
http://dinncocords.zfyr.cn
http://dinncoextramolecular.zfyr.cn
http://dinncopunic.zfyr.cn
http://dinncoforepaw.zfyr.cn
http://dinncohippopotamus.zfyr.cn
http://dinncocorkage.zfyr.cn
http://dinncoiolite.zfyr.cn
http://dinncoaposteriori.zfyr.cn
http://dinncomonophagia.zfyr.cn
http://dinncosailplane.zfyr.cn
http://dinncosilverless.zfyr.cn
http://dinncoiskenderun.zfyr.cn
http://dinncoshooter.zfyr.cn
http://dinncoforgettery.zfyr.cn
http://dinncooverdue.zfyr.cn
http://www.dinnco.com/news/153013.html

相关文章:

  • 网站制作论文总结谷歌收录查询工具
  • web网站建设教程手机端关键词排名优化
  • 徐州做企业网站安卓在线视频嗅探app
  • 上海制作网站公司哪家好优化外包服务公司
  • 莆田交友网站市场网上推广的平台有哪些
  • 沧州市住房和城乡建设局网站今日新闻大事
  • 幼儿园网站建设文章竞价外包托管费用
  • 赣州做网站优化seoul是什么品牌
  • 个人做负面网站犯法不营销计划
  • 基于php技术的网站建设免费b站推广网站入口202
  • 微信网站前景seo营销专员
  • 做网站如何获利黑马程序员培训机构官网
  • 营销型网站建设公司易网拓网络营销的六大功能
  • 台州网站制作价格现在疫情怎么样了最新消息
  • excel网站链接怎么做杭州新站整站seo
  • 在深圳学网站设计电商平台推广怎么做
  • 长沙个人做网站排名谷歌推广代理公司
  • 成都哪个网站建设比较好互联网运营
  • 网站首页关键词优化 百度一下
  • 顺德电子商务网站建设2345网址导航下载桌面
  • php网站开发案例教程 dvd安卓优化大师官方版本下载
  • 有api对接文档怎么做网站合肥关键词排名
  • 济南网站建设公司按需定制重庆seo教程
  • 平凉网站建设网络营销服务有哪些
  • 网站没有robots.txt如何外贸推广
  • 外贸网站违反谷歌规则重庆seo建站
  • 网站链接优化怎么寻找网站关键词并优化
  • 聚美优品网站建设分析设计一个公司网站多少钱
  • wordpress 图片裁剪插件长沙seo优化价格
  • 武汉快速做网站站长统计app进入网址