I will chase, I will reach, I will fly.
function debounce(func, wait, immediate) { var timeout, result; var debounced = function () { var context = this; var args = arguments; if (timeout) clearTimeout(timeout); if (immediate) { // 如果已经执行过,不再执行 var callNow = !timeout; timeout = setTimeout(function(){ timeout = null; }, wait) if (callNow) result = func.apply(context, args) } else { timeout = setTimeout(function(){ result = func.apply(cont
实现代码:<!-- 滑动条 --> <view class="m-p-40 m-bg-white" style="position: relative;overflow: hidden;"> <!-- 总 --> <view class="slider-box" style="background: #F5F5F5;width: 670rpx;height: 40rpx;"> <!-- 遮盖 --> <view class="m-bg-white" style="position: absolute;z-index: 11;width: 700rpx;height: 40rpx;transform: rotate(178deg);overflow: hidden;top: 12rpx;left: 35rpx;">
computed: { loadSrc(){ let that = this; const { width, height, thumb, imageSrc} = that; // 基础路径 let loadSrc = imageSrc + (imageSrc.indexOf('?') !== -1 ? '|' : '?') // 缩略图处理 if(thumb == true || typeof thumb == 'object'){ // 设定有宽高的 if( typeof thumb == 'object'){ const [width, height] = thumb; loadSrc += 'imageView2/3/w/' + parseInt(width) + '/h/'
在目录下,或者找个目录编写mixin.js文件/** * */ import {cache} from "@/utils/util.js" var setting = cache('setting'); export default { data() { return { } }, onShow: function() { console.log('Page Show') }, methods: { // 图片加载 $img(url, option= {}){ // local if(option.from == 'local'){ return '/static/' + (option.model || 'reception') + '/' + url + '?t=' + (new Date).getTime()
<template> <view class="load-image" :style="{width: width + 'rpx', height: height + 'rpx' }"> <image class="load-image-show" :style="{borderRadius: borderRadius + 'rpx'}" :class="{load: imgLoaded}" :src="imgLoaded ? loadImage : $img('images/imagefail.png', { from: 'local' })" mode="aspectFill" @load="imgLoaded = true" /> </view> </template> <
lettered
生,亦我所欲也;义,亦我所欲也。