
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
ant-mini-scratch
Advanced tools
tnpm i -s ant-mini-scratchCard
json
{
"defaultTitle": "刮刮卡小程序组件",
"allowsBounceVertical": "NO",
"usingComponents": {
"scratch": "ant-mini-scratchCard/es/scratch/index"
}
}
xaml
<view>
<scratch
tipText="刮刮我,有惊喜~"
tipColor="#902d02"
coverColor="#ffae8a"
ctxLogoUrl="https://gw.alipayobjects.com/zos/rmsportal/iGLmHkSxYfXveGhuzzFf.png"
resultText=''
autoFadeOut=true
resultText="{{result}}"
onFinish="onFinish"
/>
</view>
<!-- 其中,result 为动态获取的抽奖结果 -->
js
const app = getApp();
Page({
data: {
content: 'demo',
result: ''
},
onLoad(options) {
setTimeout(() => {
this.setData({
result: '很遗憾,差点就中奖了'
});
}, 1000);
},
onFinish() {
console.log('刮奖结束了');
}
});
效果图
当抽奖结果显示为图片或需要自定义样式修饰时,可以传入slot
,并将resultText
值设置为''
<!-- 将 resultText 设置为空字符串 -->
<scratch resultText=''>
<!-- 此处为 slot 子节点内容 -->
<view class="result">
<text>{{result}}</text>
</view>
</scratch>
属性 | 类型 | 默认值 | 含义 |
---|---|---|---|
width | Number | 300 | 刮刮卡宽度,默认单位px |
height | Number | 150 | 刮刮卡高度,默认单位px |
tipText | String | 刮刮我,有惊喜 | 刮奖区域提示文字 |
tipColor | String | #aaa | 提示文字的颜色 |
tipSize | Number | 20 | 提示文字的字号,默认单位px |
lineWidth | Number | 25 | 擦除线宽度,默认单位px |
activePercent | Number | 0.4 | 当被擦除比例达到该值时刮奖结束,取值范围0-1 |
autoFadeOut | Boolean | true | 当值为true 且被擦除比例达到activePercent 选项值时刮奖图层自动消失 |
ctxLogoUrl | String | 刮奖区图片背景,小程序接口限制目前只支持线上cdn 地址或离线包地址,cdn 需返回头 Access-Control-Allow-Origin: * | |
coverColor | String | #dbdbdb | 刮奖区背景色,当背景图片透明度为0 时无效 |
resultText | String | 谢谢参与 | 刮奖结果 |
onFinish | Function | ()=>{} | 刮奖结束回调,当被擦除比例达到activePercent 选项值时触发 |
FAQs
omg 刮刮卡组件的支付宝小程序版本
The npm package ant-mini-scratch receives a total of 0 weekly downloads. As such, ant-mini-scratch popularity was classified as not popular.
We found that ant-mini-scratch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.