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>
                          主站蜘蛛池模板: 代理记账_免费注册公司_营业执照代办_资质代办-【乐财汇】 | 耙式干燥机_真空耙式干燥机厂家-无锡鹏茂化工装备有限公司 | 河南道路标志牌_交通路标牌_交通标志牌厂家-郑州路畅交通 | 次氯酸钠厂家,涉水级次氯酸钠,三氯化铁生产厂家-淄博吉灿化工 | 物和码官网,物和码,免费一物一码数字化营销SaaS平台 | 展厅设计公司,展厅公司,展厅设计,展厅施工,展厅装修,企业展厅,展馆设计公司-深圳广州展厅设计公司 | 陕西自考报名_陕西自学考试网 | 冷却塔改造厂家_不锈钢冷却塔_玻璃钢冷却塔改造维修-广东特菱节能空调设备有限公司 | 上海乾拓贸易有限公司-日本SMC电磁阀_德国FESTO电磁阀_德国FESTO气缸 | 威廉希尔WilliamHill·足球(中国)体育官方网站 | 西安标准厂房_陕西工业厂房_西咸新区独栋厂房_长信科技产业园官方网站 | 定时排水阀/排气阀-仪表三通旋塞阀-直角式脉冲电磁阀-永嘉良科阀门有限公司 | 便携式高压氧舱-微压氧舱-核生化洗消系统-公众洗消站-洗消帐篷-北京利盟救援 | 热处理炉-退火炉-回火炉设备厂家-丹阳市电炉厂有限公司 | 中视电广_短视频拍摄_短视频推广_短视频代运营_宣传片拍摄_影视广告制作_中视电广 | 干洗加盟网-洗衣店品牌排行-干洗设备价格-干洗连锁加盟指南 | 飞利浦LED体育场灯具-吸顶式油站灯-飞利浦LED罩棚灯-佛山嘉耀照明有限公司 | 水平筛厂家-三轴椭圆水平振动筛-泥沙震动筛设备_山东奥凯诺矿机 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 神马影院-实时更新秒播| 航空铝型材,7系铝型材挤压,硬质阳*氧化-余润铝制品 | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 打包箱房_集成房屋-山东佳一集成房屋有限公司 | 304不锈钢无缝管_不锈钢管厂家 - 隆达钢业集团有限公司 | 压砖机_电动螺旋压力机_粉末成型压力机_郑州华隆机械tel_0371-60121717 | 优宝-汽车润滑脂-轴承润滑脂-高温齿轮润滑油脂厂家 | 济南网站策划设计_自适应网站制作_H5企业网站搭建_济南外贸网站制作公司_锐尚 | 立式_复合式_壁挂式智能化电伴热洗眼器-上海达傲洗眼器生产厂家 理化生实验室设备,吊装实验室设备,顶装实验室设备,实验室成套设备厂家,校园功能室设备,智慧书法教室方案 - 东莞市惠森教学设备有限公司 | 郑州墨香品牌设计公司|品牌全案VI设计公司 | 中国玩具展_玩具展|幼教用品展|幼教展|幼教装备展 | 自动螺旋上料机厂家价格-斗式提升机定制-螺杆绞龙输送机-杰凯上料机 | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | Honsberg流量计-Greisinger真空表-气压计-上海欧臻机电设备有限公司 | 济南ISO9000认证咨询代理公司,ISO9001认证,CMA实验室认证,ISO/TS16949认证,服务体系认证,资产管理体系认证,SC食品生产许可证- 济南创远企业管理咨询有限公司 郑州电线电缆厂家-防火|低压|低烟无卤电缆-河南明星电缆 | 耐磨焊丝,堆焊焊丝,耐磨药芯焊丝,碳化钨焊丝-北京耐默公司 | PSI渗透压仪,TPS酸度计,美国CHAI PCR仪,渗透压仪厂家_价格,微生物快速检测仪-华泰和合(北京)商贸有限公司 | 碳刷_刷握_集电环_恒压簧_电刷厂家-上海丹臻机电科技有限公司 | 升降机-高空作业车租赁-蜘蛛车-曲臂式伸缩臂剪叉式液压升降平台-脚手架-【普雷斯特公司厂家】 | 创富网-B2B网站|供求信息网|b2b平台|专业电子商务网站 | 开平机_纵剪机厂家_开平机生产厂家|诚信互赢-泰安瑞烨精工机械制造有限公司 | 深圳市万色印象美业有限公司|