89 lines
2.1 KiB
JavaScript
89 lines
2.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
const _sfc_main = {
|
|
name: "cloud-image",
|
|
emits: ["click"],
|
|
props: {
|
|
mode: {
|
|
type: String,
|
|
default() {
|
|
return "widthFix";
|
|
}
|
|
},
|
|
src: {
|
|
// type:String,
|
|
default() {
|
|
return "";
|
|
}
|
|
},
|
|
width: {
|
|
type: String,
|
|
default() {
|
|
return "100rpx";
|
|
}
|
|
},
|
|
height: {
|
|
type: String,
|
|
default() {
|
|
return "100rpx";
|
|
}
|
|
},
|
|
borderRadius: {
|
|
type: String,
|
|
default() {
|
|
return "0rpx;";
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
src: {
|
|
async handler(src) {
|
|
if (src && src.substring(0, 8) == "cloud://") {
|
|
common_vendor.er.getTempFileURL({
|
|
fileList: [src]
|
|
}).then((res) => {
|
|
this.cSrc = res.fileList[0].tempFileURL;
|
|
});
|
|
} else if (src && src.substring(0, 8) == "qiniu://") {
|
|
common_vendor.index.__f__("log", "at components/cloud-image.vue:63", src);
|
|
const uniCloudStorageExtCo = common_vendor.er.importObject("ext-storage-co");
|
|
const res = await uniCloudStorageExtCo.getTempFileURL({ src });
|
|
common_vendor.index.__f__("log", "at components/cloud-image.vue:66", res.fileList[0].tempFileURL);
|
|
this.cSrc = res.fileList[0].tempFileURL;
|
|
} else {
|
|
this.cSrc = src;
|
|
}
|
|
},
|
|
immediate: true
|
|
}
|
|
},
|
|
methods: {
|
|
onClick() {
|
|
this.$emit("click");
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
cSrc: false
|
|
};
|
|
}
|
|
};
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: $data.cSrc
|
|
}, $data.cSrc ? {
|
|
b: $props.width,
|
|
c: $props.height,
|
|
d: $props.borderRadius,
|
|
e: $data.cSrc,
|
|
f: $props.mode
|
|
} : {}, {
|
|
g: common_vendor.o((...args) => $options.onClick && $options.onClick(...args)),
|
|
h: $props.width,
|
|
i: $props.height
|
|
});
|
|
}
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/cloud-image.js.map
|