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

源码之家网站模板健身器材网站模板

源码之家网站模板,健身器材网站模板,宁波seo推荐优化,移动网站开发百度百科效果展示#xff1a; 时钟 写在前面#xff1a;vue2有this指向#xff0c;没有箭头函数 实验操作#xff1a;封装一个时钟组件 uniapp vue2 封装一个时钟组件 核心代码#xff1a; this指向的错误代码#xff0c;在下#xff1a; start() { this.myTimer setInterval(…效果展示 时钟 写在前面vue2有this指向没有箭头函数 实验操作封装一个时钟组件 uniapp vue2 封装一个时钟组件 核心代码 this指向的错误代码在下 start() {       this.myTimer setInterval(function () {         this.handleReTimer();//通过this调用失败。       }, 1000);     }, 时钟组件代码  templateview classmyTimer_homeview classtimerTitleBox同步时间/viewview classtimerDateBox{{ timerDate }}/viewview classtimerTimeBox{{ timerTime }}/viewview classtimerRefreshImgBox clickhandleReTimerimagesrc/static/images/smartCabin/titleNav/refresh_icon.pngalt一张图//view/view /template script import { getNowFormatDate, getNowData } from /utils; //获取当前日期 function getNowFormatDate() {let date new Date(),year date.getFullYear(), //获取完整的年份(4位)month date.getMonth() 1, //获取当前月份(0-11,0代表1月)strDate date.getDate(); // 获取当前日(1-31)if (month 10) month 0${month}; // 如果月份是个位数在前面补0if (strDate 10) strDate 0${strDate}; // 如果日是个位数在前面补0return ${year}-${month}-${strDate}; } //获取当前时间 function getNowData() {var a new Date();var b a.getHours();var c a.getMinutes();var d a.getSeconds();function check(val) {if (val 10) {return 0 val;} else {return val;}}return check(b) : check(c) : check(d); } export default {data() {return {myTimer: null,timerDate: ,timerTime: ,};},methods: {handleReTimer() {this.timerDate getNowFormatDate();this.timerTime getNowData();},start() {this.myTimer setInterval(this.handleReTimer, 1000);},},created() {this.start();this.handleReTimer();},destroyed() {clearInterval(this.myTimer);}, }; /script style langscss scoped .myTimer_home {width: 94%;height: 100%;font-size: 32rpx;display: flex;align-items: center;.timerDateBox {margin-right: 10px;}.timerRefreshImgBox {margin-left: 10px;display: flex;justify-content: center;align-items: center;:hover {cursor: pointer;}image {width: 40rpx;height: 40rpx;}} } /style 时钟组件(Vue3) 封装组件代码 script setup import { useUserStore } from /stores; const store useUserStore(); import { getNowFormatDate, getNowData } from /utils/replaceTime.js; import { computed, onMounted, onUnmounted, reactive, watch } from vue; import { getAssetsFile, numToStriTime } from /utils;onMounted(() {data.timerDate getNowFormatDate();data.timerTime getNowData(); }); const myTimer setInterval(() {data.timerTime getNowData(); }, 60000); onUnmounted(() {clearInterval(myTimer); }); const data reactive({timerDate: ,timerTime: , }); const handleReTimer () {data.timerDate getNowFormatDate();data.timerTime getNowData(); }; /scripttemplatediv classmyTimer_bomediv classtimerTitleBox同步时间/divdiv classtimerDateBox{{ data.timerDate }}/divdiv classtimerTimeBox{{ data.timerTime }}/divdiv classtimerRefreshImgBox clickhandleReTimerimg:srcgetAssetsFile(smartCabin/titleNav/refresh_icon.png)alt一张图//div/div /templatestyle langless scoped .myTimer_bome {width: 100%;height: 100%;font-size: calc(100vw * 18 / 1920);color: rgba(74, 79, 87, 1);display: flex;align-items: center;.timerDateBox {margin-right: 10px;}.timerRefreshImgBox {margin-left: 10px;display: flex;justify-content: center;align-items: center;:hover {cursor: pointer;}img {width: 20px;height: 20px;}} } /style
http://www.zqtcl.cn/news/514953/

相关文章:

  • 沈阳有做网站的吗青浦手机网站制作
  • 腾讯云免费建站建立一个网站英语
  • 沙漠风网站建设怎么样官方网站建设银行2010年存款利息
  • 360报危险网站微信代码小程序
  • 网站维护报价单国外 做励志视频的网站
  • 用源码做自己的网站公司网站建设哪家公司好
  • 网站运营做seohtml前端网站开发PPT
  • 上海网站定制设计图wordpress网站在线安装
  • 互动网站的核心技术wordpress不用插件
  • 厦门市建设工程交易中心网站怎么自己做游戏软件的app
  • 网站论文参考文献人力资源公司名称大全简单大气
  • 射阳做企业网站哪家好wordpress 进销存
  • 青海个人旅游网站建设wordpress用户名密码加密方式
  • 安徽平台网站建设找哪家wordpress首页加登录
  • 雅安市住房和城乡建设局网站湖南全程电子化服务平台官网
  • dw做的上传网站打不开网页制作培训价格
  • 工程网站怎么做广州做网站平台
  • 成都网站建设 全美深圳定制网站建设
  • 邢台网站建设与制作陕西高速公路建设集团网站
  • 太原 招聘 网站建设 技术经理关于 建设 二级网站
  • 如何做网站店铺的模板著名的响应式网站有哪些
  • 相城区建设网站做网站 设计师很
  • python网站开发好吗广州软件外包
  • 山东能源集团 网站建设对网站建设功能的情况说明
  • 网站设计个人各种类型网站建设口碑好
  • 西安巨久科技网站建设嘚嘚笔记 wordpress主推
  • 杭州利兴建设官方网站上海专业网站建设费
  • 自适应网站制作费用中国建设网官方网站企业登录
  • h5网站和传统网站区别电子商务主要学什么就业方向及前景
  • 凡科建站弊端各学院二级网站建设通报