在目录下,或者找个目录编写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> <
H5版本 /** * 压缩 * @param {Object} imgSrc 图片url * @param {Object} callback 回调设置返回值 */ translate(imgSrc, callback) { var that = this var img = new Image(); img.src = imgSrc; img.onload = function() { var _that = this; var h = _that.height; // 默认按比例压缩 var w = _that.width; var canvas = document.createElement('canvas');
$white: #ffffff; $primary: #fa4427; $secondary: #fe8800; $theme-color-primary: $primary; // 主色 $theme-color-secondary: $secondary; // 副色 $text-black: #222222; // 文本主色 $text-gray: #656565; // $text-white: $white; // 白色 $background-color: #f5f5f5; $border-color: #e0e0e0; // flex 样式 .z-w-100 { width: 100%; } .z-h-100 { height: 100%; } // flex 布局 .z-flex { display: flex; align-items: center; } .z-flex-1 { flex: 1; } .z-flex-wrap { flex-wrap: wrap; } .z-col-start { display:
文字不会写,直接上图
lettered
生,亦我所欲也;义,亦我所欲也。