Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
weex-marquee
Advanced tools
weex custom component---marquee,can Infinite scrolling.可以无限滚动.
**注意:**这个组件不一定能在任何地方使用,而且你可能需要对于你自己的业务进行专门定制和更改组件内部代码,如果你发现组件有任何问题,请提交一个issues.
npm install weex-marquee --save
下载本库然后引用组件:
require("weex-marquee");
<template>
<scroller class="wrapper">
<marquee marqueelist="{{marqueeList}}" timefn="ease-out" duration="{{duration}}" lineheight="50" fontsize="40" interval="{{interval}}" >
<text repeat="list in marqueeList" class="text" style="color:{{color}}">{{list}}</text>
</marquee>
<text>一个有十个数据,0~9</text>
</scroller>
</template>
<style>
.wrapper {
width: 750;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
align-items: center;
justify-content: center;
}
.text{
/*以下类型最好和marquee组件上的lineheight,fontsize相同,否则样式不一致*/
font-size:40;
line-height: 50;
}
</style>
<script>
require("weex-marquee");
module.exports = {
data: {
marqueeList:[
0,1,2,3,4,5,6,7,8,9
],
interval:2000,
duration:500
}
}
</script>
当然组件有很多属性需要你去配置,各个属性解释:
marqueelist
:这是你的数据.timefn
:动画函数,包括"ease","ease-in","ease-out","liner"等等,默认为"ease-out".duration
:单次动画持续时间,默认500毫秒.lineheight
:字体高度,默认40.fontsize
:字体大小,默认30.interval
:每个动画间隔时间,默认2000毫秒.firsttext
:手动设置第一个数据显示.
firsttext
属性使用注意:如果你的数据和上面的例子一样不需要更改,那么这个属性你是不需要的设置的.但是有时候我们拿到数据需要改变以下:
<text repeat="list in marqueeList" class="text" style="color:{{color}}">{{text}}:{{list}}</text>
这时候你就需要手动设置第一个元素的文本显示了,否则marquee没有无限滚动效果,我们需要这样设置:
<marquee marqueelist="{{marqueeList}}" timefn="ease-out" duration="{{duration}}" lineheight="50" fontsize="40" interval="{{interval}}" firsttext="{{text}}:{{marqueeList[0]}}">
<text repeat="list in marqueeList" class="text" style="color:{{color}}">{{text}}:{{list}}</text>
</marquee>
因为时间有限,并不能考虑所有的使用问题,所以如果你有能力可以自己动手扩展一下,完成后如果觉得不错可以贡献一下你的代码.
有些人和我一样,对官方的那个wxc-marquee
组件不太满意,比如无法实现无限滚动的效果,因此只能自己取实现,所以我花了一个上午的时间来构建了这个组件.
FAQs
weex custom component---marquee,can Infinite scrolling
We found that weex-marquee 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.