🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@antdigital/card-logo

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antdigital/card-logo - npm Package Compare versions

Comparing version
9.0.3
to
9.0.4
+149
main.vue
<template>
<div
:name="name"
:addManualSpm="addManualSpm"
:spmBizCode="spmBizCode"
:scm="scm"
:spm="spm"
:entityId="entityId"
:extraParams4="extraParams4"
>
<card-lottie
v-if="lottie"
:mediaUrl="lottie"
:placeholder="image"
:style="style"
:repeatCount="repeat ? -1 : 0"
:extInfo="{ playControlMode: 1 }"
@click="onImgClick()"
/>
<image
ref="image"
v-else-if="image && loaded"
:style="autoStyle"
:src="image"
:resize="realResize"
:placeholder="placeholderImage"
@on-load="handleLoad"
@click="onImgClick()"
/>
</div>
</template>
<script>
const dom = requireModule("dom");
var main = {
data: {
imgHeight: 0,
loaded: false
},
props: {
lottie: {
default: ""
},
image: {
default: ""
},
placeholderImage: {
default: ""
},
opacity: {
default: 1
},
objectFit: {
default: "stretch"
},
repeat: {
default: true
},
style: {
default: {}
},
params: {
default: null
},
// 埋点
addManualSpm: {
default: true
},
spmBizCode: {
default: "HomeAssistant"
},
name: {
default: "exposure"
},
spm: {
default: null
},
scm: {
default: null
},
entityId: {
default: null
},
extraParams4: {
default: null
}
},
onCreated() {
this.loaded = true;
this.useParams();
},
onUpdated() {
this.useParams();
},
computed: {
autoStyle() {
if (this.imgHeight) {
return {
height: `${this.imgHeight}px`,
...this.style,
opacity: this.opacity
};
}
return {
...this.style,
opacity: this.opacity
};
},
realResize() {
if (this.objectFit === "fill") {
return "stretch";
}
return this.objectFit;
}
},
methods: {
useParams() {
if (this.params) {
for (let key in this.params) {
this[key] = this.params[key];
}
}
},
handleLoad(rst) {
if (rst.detail.width && rst.detail.height) {
dom.selectorQuery([{
ref: "image",
type: "rect"
}], ({
result
}) => {
const {
width: realWidth
} = result?.[0] || {};
if (realWidth) {
const aspectRatio = rst.detail.width / rst.detail.height;
this.imgHeight = realWidth / aspectRatio;
}
});
}
},
onImgClick() {
this.$emit("onClick");
}
}
};
export { main as default };
</script>
<style />
{
"name": "@antdigital/card-logo",
"compilerType": 1,
"jsformat": 1,
"isComponent": true,
"useComponents": {
"card-lottie": "./lottie/src"
},
"assetId": "180020010101323080"
}
+3
-1
{
"name": "@antdigital/card-logo",
"version": "9.0.3",
"version": "9.0.4",
"yuyanId": "",

@@ -19,2 +19,4 @@ "repository": {

"config.schema",
"main.vue",
"manifest.json",
"esm",

@@ -21,0 +23,0 @@ "main.zst"

# @antdigital/card-component-boilerplate
> [card component](https://yuque.antfin.com/fish-pond/card/component-develop) 卡片组件
<!--COVER-->

@@ -14,16 +12,1 @@

```
## Usage
[参考文档](https://yuque.antfin.com/fish-pond/card/component-develop)
## Document
[组件语法规范](https://yuque.antfin.com/fish-pond/card/syntax-component)
## Usage
- [卡片官方文档](https://yuque.antfin.com/fish-pond/card/)
- [快速上手 > 卡片组件](https://yuque.antfin.com/fish-pond/card/syntax-component)