Adjusted vue-scrollto definition for vue-scrollto version 2.15 (#37666)

* Adjusted vue-scrollto definition for vue-scrollto version 2.15

* Removed an empty line to start broken build

* Added an empty line to start broken build

* Fixed linter issues

* Aligned VueScrollTo definition with other vue plugins definitions
This commit is contained in:
Christian Stornowski
2019-09-11 16:10:48 +02:00
committed by Mine Starks
parent d0bf79fca4
commit cfa587388d
2 changed files with 11 additions and 6 deletions

View File

@@ -1,10 +1,11 @@
// Type definitions for vue-scrollto 2.14
// Type definitions for vue-scrollto 2.15
// Project: https://github.com/rigor789/vue-scrollto#readme
// Definitions by: Kovács Vince <https://github.com/vincekovacs>
// ChristianStornowski <https://github.com/ChristianStornowski>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { PluginFunction } from "vue";
import { PluginFunction, PluginObject } from "vue";
declare namespace VueScrollTo {
interface Options {
@@ -16,7 +17,7 @@ declare namespace VueScrollTo {
// The duration (in milliseconds) of the scrolling animation. Default: 500
duration?: number;
// The easing to be used when animating. Default: ease
easing?: string;
easing?: string | [number, number, number, number];
// The offset that should be applied when scrolling. Default: 0
offset?: number;
// Indicates if scrolling should be performed, even if the scroll target is already in view. Default: true
@@ -45,10 +46,9 @@ declare namespace VueScrollTo {
}
}
declare class VueScrollTo {
static install: PluginFunction<never>;
interface VueScrollToPlugin extends PluginObject<VueScrollTo.Options> {
scrollTo: VueScrollTo.VueStatic;
setDefaults: VueScrollTo.VueStatic;
}
declare module 'vue/types/vue' {
@@ -57,4 +57,5 @@ declare module 'vue/types/vue' {
}
}
declare const VueScrollTo: VueScrollToPlugin;
export = VueScrollTo;

View File

@@ -2,10 +2,14 @@ import Vue from "vue";
import * as VueScrollTo from "vue-scrollto";
Vue.use(VueScrollTo);
Vue.use(VueScrollTo, {offset: -100});
VueScrollTo.setDefaults({offset: -100});
class Test extends Vue {
mounted() {
this.$scrollTo(this.$el, {offset: -100});
this.$scrollTo("#id");
VueScrollTo.scrollTo("#id", {offset: -100});
}
}