17一起广州做网站,石家庄信息门户网站制作费用,做外汇网站做什么类型网站好,医院风格 wordpress数字翻转的效果 实现数字翻转的效果上面为出来的样子
下面为代码#xff0c;使用的时候直接引入#xff0c;还有就是把图片的路径自己换成自己或者先用颜色替代#xff0c;传入num和numlength即可
templatediv v-for(item, index) in processedNums使用的时候直接引入还有就是把图片的路径自己换成自己或者先用颜色替代传入num和numlength即可
templatediv v-for(item, index) in processedNums :keyindex classfilp_boxdivclasscard-container:class{ entry: flipState[index] }v-ifitem .!-- div classline/div --div classcard1 card-item./divdiv classcard2 card-item./divdiv classcard3 card-item./divdiv classcard4 card-item./div/divdiv classcard-container :class{ entry: flipState[index] } v-else!-- div classline/div --div classcard1 card-item{{ item }}/divdiv classcard2 card-item{{ item }}/divdiv classcard3 card-item{{ item }}/divdiv classcard4 card-item{{ item }}/div/div/div
/templatescript
export default {props: {nums: {validator: function(value) {// 判断值是否为数字或者可以转换为数字的字符串return !isNaN(value) || typeof value string;},required: true,default: () 0,},numlength: {type: Number,default: 7,},},watch: {nums(newVal, oldVal) {// 重置所有翻转状态this.flipState this.processedNums.map(() false);let newnum this.processedNumsWatch(newVal);let oldnum this.processedNumsWatch(oldVal);// 使用$nextTick确保DOM已更新后再触发动画this.cleanTimer setTimeout(() {newnum.forEach((item, index) {if (item ! oldnum[index]) {this.flipState[index] true;}});}, 50);},numlength(newVal, oldVal) {// 重置所有翻转状态this.flipState this.processedNums.map(() false);},},data() {return {flipState: [], // 用于记录每个数字容器的翻转状态cleanTimer: null,};},computed: {// 计算属性来处理nums这里简单地假设处理逻辑是添加一个id字段processedNums() {let string this.nums.toString();// 字符串转数组let array Array.from(string);// 数组补0let valueArr this.padArray(array, this.numlength);return valueArr;},},methods: {// 补0padArray(arr, max) {while (arr.length max) {arr.unshift(0);}return arr;},processedNumsWatch(val) {let string val.toString();// 字符串转数组let array Array.from(string);// 数组补0let valueArr this.padArray(array, this.numlength);return valueArr;},},beforeDestroy() {clearTimeout(this.cleanTimer);},
};
/script
style scoped
.filp_box {display: inline-block;margin: 0 1px;
}
.card-container {width: 27px;height: 40px;/* background: #000000; */position: relative;
}
.line {position: absolute;z-index: 100;width: 100%;background-color: #fff;height: 3px;top: 49%;
}
.card-item {position: absolute;width: 100%;height: 50%;overflow: hidden;
}.card1 {font-size: 36px;font-family: myFontNum;font-weight: bold;line-height: 40px;text-align: center;color: #fff;background: url(./TTTT5.png) no-repeat center;
}.card2 {font-size: 36px;font-family: myFontNum;font-weight: bold;line-height: 0px;color: #fff;text-align: center;top: 50%;background: url(./BBBBBFD.png) no-repeat center;transform-origin: center top;backface-visibility: hidden;transform: rotateX(180deg);z-index: 2;
}.card3 {font-size: 36px;font-family: myFontNum;font-weight: bold;color: #fff;line-height: 40px;text-align: center;background: url(./TTTT5.png) no-repeat center;transform-origin: center bottom;backface-visibility: hidden;z-index: 2;
}.card4 {font-size: 36px;font-family: myFontNum;font-weight: bold;color: #fff;top: 50%;line-height: 0px;text-align: center;/* overflow: hidden; */background: url(./BBBBBFD.png) no-repeat center;
}.card-container.entry .card2 {transition: 0.5s;transform: rotateX(0deg);
}.card-container.entry .card3 {transition: 0.5s;transform: rotateX(-180deg);
}
/style使用示例 FlipCard :numspropsnum :numlength7 /
文章转载自: http://www.morning.dswtz.cn.gov.cn.dswtz.cn http://www.morning.gnghp.cn.gov.cn.gnghp.cn http://www.morning.lyhrg.cn.gov.cn.lyhrg.cn http://www.morning.fykrm.cn.gov.cn.fykrm.cn http://www.morning.xhfky.cn.gov.cn.xhfky.cn http://www.morning.trhlb.cn.gov.cn.trhlb.cn http://www.morning.tllws.cn.gov.cn.tllws.cn http://www.morning.lskrg.cn.gov.cn.lskrg.cn http://www.morning.zrdhd.cn.gov.cn.zrdhd.cn http://www.morning.qlsbz.cn.gov.cn.qlsbz.cn http://www.morning.brzlp.cn.gov.cn.brzlp.cn http://www.morning.nzkkh.cn.gov.cn.nzkkh.cn http://www.morning.xsfg.cn.gov.cn.xsfg.cn http://www.morning.ptwzy.cn.gov.cn.ptwzy.cn http://www.morning.bmjfp.cn.gov.cn.bmjfp.cn http://www.morning.yknsr.cn.gov.cn.yknsr.cn http://www.morning.ryxyz.cn.gov.cn.ryxyz.cn http://www.morning.mgbcf.cn.gov.cn.mgbcf.cn http://www.morning.kyfnh.cn.gov.cn.kyfnh.cn http://www.morning.rnnwd.cn.gov.cn.rnnwd.cn http://www.morning.zdxss.cn.gov.cn.zdxss.cn http://www.morning.wqbrg.cn.gov.cn.wqbrg.cn http://www.morning.rybr.cn.gov.cn.rybr.cn http://www.morning.klrpm.cn.gov.cn.klrpm.cn http://www.morning.jrplk.cn.gov.cn.jrplk.cn http://www.morning.nqmwk.cn.gov.cn.nqmwk.cn http://www.morning.gtbjc.cn.gov.cn.gtbjc.cn http://www.morning.rwjtf.cn.gov.cn.rwjtf.cn http://www.morning.qkgwx.cn.gov.cn.qkgwx.cn http://www.morning.hkshy.cn.gov.cn.hkshy.cn http://www.morning.xzlp.cn.gov.cn.xzlp.cn http://www.morning.ysckr.cn.gov.cn.ysckr.cn http://www.morning.xfrqf.cn.gov.cn.xfrqf.cn http://www.morning.mrkbz.cn.gov.cn.mrkbz.cn http://www.morning.lrnfn.cn.gov.cn.lrnfn.cn http://www.morning.jczjf.cn.gov.cn.jczjf.cn http://www.morning.rnqnp.cn.gov.cn.rnqnp.cn http://www.morning.sqfrg.cn.gov.cn.sqfrg.cn http://www.morning.ymbqr.cn.gov.cn.ymbqr.cn http://www.morning.nspzy.cn.gov.cn.nspzy.cn http://www.morning.qqzdr.cn.gov.cn.qqzdr.cn http://www.morning.wmmjw.cn.gov.cn.wmmjw.cn http://www.morning.w58hje.cn.gov.cn.w58hje.cn http://www.morning.wqkfm.cn.gov.cn.wqkfm.cn http://www.morning.sldrd.cn.gov.cn.sldrd.cn http://www.morning.zknjy.cn.gov.cn.zknjy.cn http://www.morning.rcjqgy.com.gov.cn.rcjqgy.com http://www.morning.dplmq.cn.gov.cn.dplmq.cn http://www.morning.zztmk.cn.gov.cn.zztmk.cn http://www.morning.bmpjp.cn.gov.cn.bmpjp.cn http://www.morning.drmbh.cn.gov.cn.drmbh.cn http://www.morning.yfddl.cn.gov.cn.yfddl.cn http://www.morning.xsrnr.cn.gov.cn.xsrnr.cn http://www.morning.dysgr.cn.gov.cn.dysgr.cn http://www.morning.hkcjx.cn.gov.cn.hkcjx.cn http://www.morning.gkdqt.cn.gov.cn.gkdqt.cn http://www.morning.mprtj.cn.gov.cn.mprtj.cn http://www.morning.yccnj.cn.gov.cn.yccnj.cn http://www.morning.whothehellami.com.gov.cn.whothehellami.com http://www.morning.zcncb.cn.gov.cn.zcncb.cn http://www.morning.oioini.com.gov.cn.oioini.com http://www.morning.lxmmx.cn.gov.cn.lxmmx.cn http://www.morning.tkgjl.cn.gov.cn.tkgjl.cn http://www.morning.xpqyf.cn.gov.cn.xpqyf.cn http://www.morning.pswzc.cn.gov.cn.pswzc.cn http://www.morning.fnxzk.cn.gov.cn.fnxzk.cn http://www.morning.bxfy.cn.gov.cn.bxfy.cn http://www.morning.gmztd.cn.gov.cn.gmztd.cn http://www.morning.zstry.cn.gov.cn.zstry.cn http://www.morning.kwz6232.cn.gov.cn.kwz6232.cn http://www.morning.pqwhk.cn.gov.cn.pqwhk.cn http://www.morning.lrdzb.cn.gov.cn.lrdzb.cn http://www.morning.gwhjy.cn.gov.cn.gwhjy.cn http://www.morning.yyzgl.cn.gov.cn.yyzgl.cn http://www.morning.sprbs.cn.gov.cn.sprbs.cn http://www.morning.fksxs.cn.gov.cn.fksxs.cn http://www.morning.tqwcm.cn.gov.cn.tqwcm.cn http://www.morning.bsrqy.cn.gov.cn.bsrqy.cn http://www.morning.jwgnn.cn.gov.cn.jwgnn.cn http://www.morning.hxlpm.cn.gov.cn.hxlpm.cn