pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  1. <small id='3pgxf'></small><noframes id='3pgxf'>

  2. <tfoot id='3pgxf'></tfoot>
  3. <legend id='3pgxf'><style id='3pgxf'><dir id='3pgxf'><q id='3pgxf'></q></dir></style></legend>

    <i id='3pgxf'><tr id='3pgxf'><dt id='3pgxf'><q id='3pgxf'><span id='3pgxf'><b id='3pgxf'><form id='3pgxf'><ins id='3pgxf'></ins><ul id='3pgxf'></ul><sub id='3pgxf'></sub></form><legend id='3pgxf'></legend><bdo id='3pgxf'><pre id='3pgxf'><center id='3pgxf'></center></pre></bdo></b><th id='3pgxf'></th></span></q></dt></tr></i><div class="y2mcg20" id='3pgxf'><tfoot id='3pgxf'></tfoot><dl id='3pgxf'><fieldset id='3pgxf'></fieldset></dl></div>
      <bdo id='3pgxf'></bdo><ul id='3pgxf'></ul>

      在 Angular 2/Typescript 中使用 IScroll

      Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)

      • <legend id='61aDn'><style id='61aDn'><dir id='61aDn'><q id='61aDn'></q></dir></style></legend>

      • <i id='61aDn'><tr id='61aDn'><dt id='61aDn'><q id='61aDn'><span id='61aDn'><b id='61aDn'><form id='61aDn'><ins id='61aDn'></ins><ul id='61aDn'></ul><sub id='61aDn'></sub></form><legend id='61aDn'></legend><bdo id='61aDn'><pre id='61aDn'><center id='61aDn'></center></pre></bdo></b><th id='61aDn'></th></span></q></dt></tr></i><div class="8okouic" id='61aDn'><tfoot id='61aDn'></tfoot><dl id='61aDn'><fieldset id='61aDn'></fieldset></dl></div>
        <tfoot id='61aDn'></tfoot>
      • <small id='61aDn'></small><noframes id='61aDn'>

          <tbody id='61aDn'></tbody>
              <bdo id='61aDn'></bdo><ul id='61aDn'></ul>
                本文介紹了在 Angular 2/Typescript 中使用 IScroll的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我想使用一個名為 iscroll 的 Javascript 庫.

                i want to use a Javascript Libary called iscroll.

                到目前為止,我得到了 iscroll.d.ts,現在我想使用它,但我是 typescript 的新手,不知道該怎么做.

                So far i got the iscroll.d.ts and now i want to use it, but iam new at typescript and dont know how to do that.

                我的 iscroll.d.ts 看起來像這樣:

                My iscroll.d.ts looks like this:

                // Generated by typings
                // Source: https://raw.githubusercontent.com/types/typed-iscroll/8524f7c88e521c16462553173c9ea99e9e3d477c/iscroll.d.ts
                declare module 'iscroll' {
                class IScroll {
                  version: string;
                
                  constructor(element: string | HTMLElement, options?: IScroll.IScrollOptions);
                
                  destroy(): void;
                  resetPosition(time: number): boolean;
                  disable(): void;
                  enable(): void;
                  refresh(): void;
                  scrollTo(x: number, y: number, time?: number, easing?: IScroll.IScrollEaseOption): void;
                  scrollBy(x: number, y: number, time?: number, easing?: IScroll.IScrollEaseOption): void;
                  scrollToElement(el: HTMLElement | string, time?: number, offsetX?: number, offsetY?: number, easing?: IScroll.IScrollEaseOption): void;
                  goToPage(x: number, y: number, time?: number, easing?: IScroll.IScrollEaseOption): void;
                  prev(): void;
                  next(): void;
                  zoom(scale: number, x: number, y: number, time?: number): void;
                  refresh(): void;
                  destroy(): void;
                
                  utils: IScroll.IScrollUtils;
                
                  // Events
                  on(type: 'beforeScrollStart' |
                    'scrollCancel' |
                    'scrollStart' |
                    'scrollEnd' |
                    'flick' |
                    'zoomStart' |
                    'zoomEnd', fn: (evt?: any) => void): void;
                  off(type: string, fn?: (evt?: any) => void): void;
                
                }
                
                namespace IScroll {
                  export interface IScrollIndicatorOptions {
                    el?: HTMLElement | string;
                    fade?: boolean;
                    ignoreBoundaries?: boolean;
                    interactive?: boolean;
                    listenX?: boolean;
                    listenY?: boolean;
                    resize?: boolean;
                    shrink?: boolean;
                    speedRatioX?: number;
                    speedRatioY?: number;
                  }
                
                  export interface IScrollKeyBindings {
                    pageUp?: number | string,
                    pageDown: number | string;
                    end: number | string;
                    home: number | string;
                    left: number | string;
                    up: number | string;
                    right: number | string;
                    down: number | string;
                  }
                
                  export interface IScrollOptions {
                
                    indicators?: IScrollIndicatorOptions;
                
                    // Scrollbar
                    scrollbars?: boolean | string;
                    fadeScrollbars?: boolean;
                    interactiveScrollbars?: boolean;
                    resizeScrollbars?: boolean;
                    shrinkScrollbars?: boolean;
                
                    // Zoom
                    zoom?: boolean;
                    zoomMin?: number;
                    zoomMax?: number;
                    startZoom?: number;
                    wheelAction?: string;
                
                    snap?: boolean | string;
                
                    bindToWrapper?: boolean;
                    bounceEasing?: string | IScrollEaseOption;
                    bounceTime?: number;
                    deceleration?: number;
                    mouseWheelSpeed?: number;
                    preventDefaultException?: any;
                    resizePolling?: number;
                    probeType?: number;
                    keyBindings?: boolean | IScrollKeyBindings;
                
                    useTransform?: boolean;
                    useTransition?: boolean;
                    HWCompositing?: boolean;
                    bounce?: boolean;
                    click?: boolean;
                    disableMouse?: boolean;
                    disablePointer?: boolean;
                    disableTouch?: boolean;
                    eventPassthrough?: boolean;
                    freeScroll?: boolean;
                    invertWheelDirection?: boolean;
                    momentum?: boolean;
                    mouseWheel?: boolean;
                    preventDefault?: boolean;
                    tap?: boolean | string;
                
                    scrollX?: number;
                    scrollY?: number;
                    startX?: number;
                    startY?: number;
                
                    // Infinite options
                    infiniteElements: HTMLElement | 'string';
                    cacheSize: number;
                    dataset: (start: number, count: number) => Object[];
                  }
                
                  export interface IScrollEaseOption {
                    style: 'string';
                    fn: Function;
                  }
                  export interface IScrollEaseOptions {
                    quadratic: IScrollEaseOption;
                    circular: IScrollEaseOption;
                    back: IScrollEaseOption;
                    bounce: IScrollEaseOption;
                    elastic: IScrollEaseOption;
                  }
                
                  export interface IScrollUtils {
                    ease: IScrollEaseOptions;
                  }
                }
                
                export = IScroll;
                }
                

                我的 Angular 2 page.ts 看起來像這樣:

                And my Angular 2 page.ts looks like this:

                import {NavController} from "ionic-angular";
                import {AngularFire, AuthProviders, AuthMethods } from "angularfire2";
                import {OnInit, Inject, Component} from "@angular/core";
                import {UserService} from '../../../services/UserService';
                import {AuthPage} from "../home/home";
                import { IScroll } from "iscroll"
                
                @Component({
                    templateUrl: "build/pages/auth/onboarding/onboarding.html",
                    providers: [UserService]
                })
                
                export class OnboardingPage {
                
                    iScroll: IScroll;
                
                    onboardingStep: number = 1;
                

                到目前為止,導入工作正常,但我不知道如何初始化和使用 iscroll.

                The Import works fine so far, i think but i dont know how to init and use iscroll.

                希望你們中的一些人有任何提示如何將其變為現實:)

                Hope some of you got any tips how to bring that to life :)

                推薦答案

                您可以像在普通的舊 javascript 中使用它一樣使用它,不同之處在于您還可以包含類型.

                You use it just like you'd use it in plain old javascript, with the difference that you can also include types.

                例如,javascript:

                For example, javascript:

                let myScroll = new IScroll("#CONTAINER_ID");
                

                打字稿:

                let myScroll: IScroll = new IScroll("#CONTAINER_ID");
                

                (注意 :IScroll 不是必需的,編譯器可以推斷類型,但我添加它是為了說明一點)

                (notice that the : IScroll isn't needed, the compiler can infer the type, but I added it to make a point)

                在你的情況下:

                export class OnboardingPage {
                    iScroll: IScroll;
                
                    constructor() {
                        this.iScroll = new IScroll("#CONTAINER_ID");
                    }
                }
                

                此代碼基于他們的文檔(https://github.com/cubiq/iscroll)但根據您發布的 .d.ts 文件,它需要使用 iscroll 命名空間:

                This code is based on their documentation (https://github.com/cubiq/iscroll) but according to the .d.ts file you posted it requires to use the iscroll namespace:

                let myScroll = new iscroll.IScroll("#CONTAINER_ID");
                

                希望這會有所幫助.

                這篇關于在 Angular 2/Typescript 中使用 IScroll的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)
                How to reload the ion-page after pop() in ionic2(如何在 ionic2 中的 pop() 之后重新加載離子頁面)
                  <tfoot id='6uFrE'></tfoot>

                  1. <small id='6uFrE'></small><noframes id='6uFrE'>

                        <bdo id='6uFrE'></bdo><ul id='6uFrE'></ul>
                        <i id='6uFrE'><tr id='6uFrE'><dt id='6uFrE'><q id='6uFrE'><span id='6uFrE'><b id='6uFrE'><form id='6uFrE'><ins id='6uFrE'></ins><ul id='6uFrE'></ul><sub id='6uFrE'></sub></form><legend id='6uFrE'></legend><bdo id='6uFrE'><pre id='6uFrE'><center id='6uFrE'></center></pre></bdo></b><th id='6uFrE'></th></span></q></dt></tr></i><div class="ma2iws0" id='6uFrE'><tfoot id='6uFrE'></tfoot><dl id='6uFrE'><fieldset id='6uFrE'></fieldset></dl></div>

                          <tbody id='6uFrE'></tbody>
                        <legend id='6uFrE'><style id='6uFrE'><dir id='6uFrE'><q id='6uFrE'></q></dir></style></legend>
                          主站蜘蛛池模板: 真空泵维修保养,普发,阿尔卡特,荏原,卡西亚玛,莱宝,爱德华干式螺杆真空泵维修-东莞比其尔真空机电设备有限公司 | 珠海白蚁防治_珠海灭鼠_珠海杀虫灭鼠_珠海灭蟑螂_珠海酒店消杀_珠海工厂杀虫灭鼠_立净虫控防治服务有限公司 | 喷码机,激光喷码打码机,鸡蛋打码机,手持打码机,自动喷码机,一物一码防伪溯源-恒欣瑞达有限公司 | 盘煤仪,盘料仪,盘点仪,堆料测量仪,便携式激光盘煤仪-中科航宇(北京)自动化工程技术有限公司 | 实战IT培训机构_IT培训班选大学生IT技术培训中心_中公优就业 | 碳刷_刷握_集电环_恒压簧_电刷厂家-上海丹臻机电科技有限公司 | 潍坊青州古城旅游景点攻略_青州酒店美食推荐-青州旅游网 | 天津次氯酸钠酸钙溶液-天津氢氧化钠厂家-天津市辅仁化工有限公司 | 三板富 | 专注于新三板的第一垂直服务平台 | 广州番禺搬家公司_天河黄埔搬家公司_企业工厂搬迁_日式搬家_广州搬家公司_厚道搬迁搬家公司 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 艺术涂料_进口艺术涂料_艺术涂料加盟_艺术涂料十大品牌 -英国蒙太奇艺术涂料 | 中医治疗皮肤病_潍坊银康医院「山东」重症皮肤病救治平台 | 六维力传感器_六分量力传感器_模腔压力传感器-南京数智微传感科技有限公司 | 广东机电安装工程_中央空调工程_东莞装饰装修-广东粤标建设有限公司 | 苏州西朗门业-欧盟CE|莱茵UL双认证的快速卷帘门品牌厂家 | 空冷器|空气冷却器|空水冷却器-无锡赛迪森机械有限公司[官网] | 污泥烘干机-低温干化机-工业污泥烘干设备厂家-焦作市真节能环保设备科技有限公司 | 经济师考试_2025中级经济师报名时间_报名入口_考试时间_华课网校经济师培训网站 | 纸箱抗压机,拉力机,脂肪测定仪,定氮仪-山东德瑞克仪器有限公司 | 机房监控|动环监控|动力环境监控系统方案产品定制厂家 - 迈世OMARA | 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 欧盟ce检测认证_reach检测报告_第三方检测中心-深圳市威腾检验技术有限公司 | 通风天窗,通风气楼,屋顶通风天窗,屋顶通风天窗公司 | 广州企亚 - 数码直喷、白墨印花、源头厂家、透气无手感方案服务商! | 连栋温室大棚建造厂家-智能玻璃温室-薄膜温室_青州市亿诚农业科技 | 重庆磨床过滤机,重庆纸带过滤机,机床伸缩钣金,重庆机床钣金护罩-重庆达鸿兴精密机械制造有限公司 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 中国产业发展研究网 - 提供行业研究报告 可行性研究报告 投资咨询 市场调研服务 | 烟气在线监测系统_烟气在线监测仪_扬尘检测仪_空气质量监测站「山东风途物联网」 | 春腾云财 - 为企业提供专业财税咨询、代理记账服务 | 手板_手板模型制作_cnc手板加工厂-东莞天泓 | 冷库安装厂家_杭州冷库_保鲜库建设-浙江克冷制冷设备有限公司 | 连续密炼机_双转子连续密炼机_连续式密炼机-南京永睿机械制造有限公司 | 飞扬动力官网-广告公司管理软件,广告公司管理系统,喷绘写真条幅制作管理软件,广告公司ERP系统 | 微波消解仪器_智能微波消解仪报价_高压微波消解仪厂家_那艾 | 河北中仪伟创试验仪器有限公司是专业生产沥青,土工,水泥,混凝土等试验仪器的厂家,咨询电话:13373070969 | 工控机-工业平板电脑-研华工控机-研越无风扇嵌入式box工控机 | 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 | 智能汉显全自动量热仪_微机全自动胶质层指数测定仪-鹤壁市科达仪器仪表有限公司 | 旗杆生产厂家_不锈钢锥形旗杆价格_铝合金电动旗杆-上海锥升金属科技有限公司 |