增加群相册功能,长按朋友圈文字可以复制
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<view @longpress="longpress" >
|
||||
<u-image
|
||||
@click="click"
|
||||
:width="width"
|
||||
:height="height"
|
||||
:mode="mode"
|
||||
@error="errorHandle"
|
||||
:src="cachesrc"></u-image>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import util from "@/util";
|
||||
export default {
|
||||
name: "CacheImage",
|
||||
props: {
|
||||
src: String,
|
||||
type: {
|
||||
type: String,
|
||||
default: "images",
|
||||
},
|
||||
mode:{
|
||||
type: String,
|
||||
default: "aspectFill",
|
||||
},
|
||||
width: {
|
||||
type: Number|String,
|
||||
default: "100",
|
||||
},
|
||||
height: {
|
||||
type: Number|String,
|
||||
default: "",
|
||||
},
|
||||
shape:{
|
||||
type: String,
|
||||
default: "square",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cachesrc:"",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.init(this.src);
|
||||
},
|
||||
methods: {
|
||||
init(nv){
|
||||
const _this = this;
|
||||
if (nv) {
|
||||
util.cacheFile(util.cdn(nv),this.type).then(res=>{
|
||||
_this.cachesrc = res;
|
||||
//console.log(_this.cachesrc);
|
||||
});
|
||||
return ;
|
||||
}
|
||||
},
|
||||
errorHandle() {
|
||||
this.cachesrc="/static/images/default_image.png";
|
||||
},
|
||||
click() {
|
||||
this.$emit("click");
|
||||
},
|
||||
longpress() {
|
||||
this.$emit("longpress");
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
Reference in New Issue
Block a user