mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-30 17:04:20 +08:00
fix vue-router
fix namespace
This commit is contained in:
@@ -8,8 +8,15 @@ namespace TestBasic {
|
||||
var Foo = Vue.extend({
|
||||
template: "<p>This is foo!</p>",
|
||||
route: {
|
||||
canActivate(transition: vuerouter.Transition<any, any, any, any, any>) {
|
||||
canActivate(transition: vuejs.Transition<any, any, any, any, any>) {
|
||||
return true;
|
||||
},
|
||||
activate: function() {
|
||||
var p: PromiseLike<any>;
|
||||
return p;
|
||||
},
|
||||
deactivate: function(transition: vuejs.Transition<any, any, any, any, any>) {
|
||||
transition.next();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -43,7 +50,7 @@ namespace TestAdvanced {
|
||||
|
||||
namespace App {
|
||||
|
||||
export class App {
|
||||
export class App extends Vue {
|
||||
authenticating: boolean;
|
||||
|
||||
data() {
|
||||
@@ -55,25 +62,12 @@ namespace TestAdvanced {
|
||||
}
|
||||
|
||||
namespace Inbox {
|
||||
export class Index {
|
||||
static route: vuerouter.TransitionHook<App.App, any, any, { id: number }, any> = {
|
||||
canActivate: function(transition) {
|
||||
var n: number = transition.to.params.id;
|
||||
transition.next();
|
||||
},
|
||||
activate: function() {
|
||||
var p: PromiseLike<any>;
|
||||
return p;
|
||||
},
|
||||
deactivate: function({next}) {
|
||||
next();
|
||||
}
|
||||
};
|
||||
export class Index extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
namespace RouteConfig {
|
||||
export function configRouter(router: vuerouter.Router<App.App>) {
|
||||
export function configRouter(router: vuejs.Router<App.App>) {
|
||||
router.map({
|
||||
"/about": {
|
||||
component: {},
|
||||
|
||||
12
vue-router/vue-router.d.ts
vendored
12
vue-router/vue-router.d.ts
vendored
@@ -5,7 +5,7 @@
|
||||
|
||||
/// <reference path="../vue/vue.d.ts" />
|
||||
|
||||
declare namespace vuerouter {
|
||||
declare namespace vuejs {
|
||||
|
||||
interface Transition<RootVueApp, FromParams, FromQuery, ToParams, ToQuery> {
|
||||
from: $route<RootVueApp, FromParams, FromQuery>;
|
||||
@@ -71,20 +71,18 @@ declare namespace vuerouter {
|
||||
canDeactivate?(transition?: Transition<Root, FP, FQ, TP, TQ>): PromiseLike<any> | boolean | void;
|
||||
canReuse?: boolean | ((transition: Transition<Root, FP, FQ, TP, TQ>) => boolean);
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace vuejs {
|
||||
interface Vue {
|
||||
$route?: vuerouter.$route<any, any, any>;
|
||||
$router?: vuerouter.Router<any>;
|
||||
$route: vuejs.$route<any, any, any>;
|
||||
$router: vuejs.Router<any>;
|
||||
}
|
||||
|
||||
interface ComponentOption {
|
||||
route?: vuerouter.TransitionHook<any, any, any, any, any>;
|
||||
route?: vuejs.TransitionHook<any, any, any, any, any>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var VueRouter: vuerouter.RouterStatic;
|
||||
declare var VueRouter: vuejs.RouterStatic;
|
||||
|
||||
declare module "vue-router" {
|
||||
export = VueRouter;
|
||||
|
||||
Reference in New Issue
Block a user