fix vue-router

fix namespace
This commit is contained in:
Kaoru Hagihara
2016-03-06 01:21:41 +09:00
parent 9f0f926a12
commit 6448efc226
2 changed files with 16 additions and 24 deletions

View File

@@ -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: {},

View File

@@ -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;