npm i --save nativescript-slider
- 版本:1.0.1
- GitHub: https://github.com/kazemihabib/nativescript-slider
- NPM: https://npmjs.net.cn/package/nativescript-slider
- 下载量
- 昨日:0
- 上周:0
- 上月:5
NativeScript Slider
这是一个基于 https://github.com/NativeScript/NativeScript/tree/master/tns-core-modules/ui/slider (tns 核心模块) 的拖拽事件分支。
有什么区别?
Added dragged event that fires when the user drags the slider.
currently this event added just for android.
为什么我要使用这个事件,而不是使用滑块值属性的双向绑定呢?
It is usefull when the value can change programmatically and by user for example when creating player.
安装
tns plugin add nativescript-slider
用法
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:seekbar="nativescript-slider"
loaded="pageLoaded">
<StackLayout>
<seekbar:Slider value="50" maxValue="100" dragged="{{dragged}}" />
</StackLayout>
</Page>
dragged(args){
let newValue = args.newValue;
let object = args.object;
}
如何与 Angular2 一起使用
import {registerElement} from "nativescript-angular/element-registry";
registerElement("TNSSlider", () => require("nativescript-slider").Slider);
<TNSSlider [value]="currentPosition" [maxValue]="movieLength" (dragged)="fromUser($event)" ></TNSSlider>