小编Chr*_*sen的帖子

错误:*.default不是构造函数

我在测试一些javascript代码时得到以下错误,从一个打字稿文件中转换而来.

这是错误:

Error: _mapAction2.default is not a constructor
Run Code Online (Sandbox Code Playgroud)

以下是导致错误的代码行:

var mapAction = new MapAction(MapActionType.POLYGONDRAGGED, []);
Run Code Online (Sandbox Code Playgroud)

这是原始的typescript -file map-action.ts:

import { IMapAction} from './imap-action';
import { MapActionType } from './map-action-type.enum';
import {LatLngLiteral} from 'angular2-google-maps/core';

export class MapAction implements IMapAction{
    type: MapActionType;
    paths: Array<LatLngLiteral>;

    constructor(mapActionType: MapActionType, paths: Array<LatLngLiteral>){
        this.type = mapActionType;
        this.paths = paths;
    }

    public getType(): MapActionType{
        return this.type;
    }

    public getPaths(): Array<LatLngLiteral>
    {
        return this.paths;
    }

}
Run Code Online (Sandbox Code Playgroud)

这是转换后的.js文件map-action.js:

"use strict";
class MapAction {
    constructor(mapActionType, paths) { …
Run Code Online (Sandbox Code Playgroud)

javascript typescript ava

40
推荐指数
3
解决办法
4万
查看次数

光滑的轮播平滑滚动

我已经使用光滑的轮播一段时间了,但我很好奇是否可以调整轮播以获得平滑的滚动效果,就像在手机上垂直滚动(在给定的网页上)时获得的效果相同.)。

换句话说,我希望光滑的轮播以可变的速度滚动,具有连续的流动,并且当您不再触摸轮播时,最终不会自动回到轮播/元素的开头。

谢谢

javascript jquery smooth-scrolling carousel slick.js

5
推荐指数
2
解决办法
2万
查看次数