forked from nuxt-community/nuxt-property-decorator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reformatted code and added missing exports
- Loading branch information
Showing
8 changed files
with
221 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
import Vue, { VNode } from 'vue'; | ||
import { Component, Emit, Inject, Model, Prop, Provide, Watch } from '../src/nuxt-property-decorator'; | ||
import Vue, { VNode } from "vue" | ||
import { | ||
Component, | ||
Emit, | ||
Inject, | ||
Model, | ||
Prop, | ||
Provide, | ||
Watch | ||
} from "../src/nuxt-property-decorator" | ||
|
||
@Component | ||
export default class EmitFixture extends Vue { | ||
count = 0; | ||
count = 0 | ||
|
||
@Emit('reset') resetCount() { | ||
this.count = 0; | ||
@Emit("reset") resetCount() { | ||
this.count = 0 | ||
} | ||
|
||
@Emit() increment(n: number) { | ||
this.count += n; | ||
this.count += n | ||
} | ||
|
||
@Emit() canceled() { | ||
return false; | ||
return false | ||
} | ||
|
||
render (createElement: any): VNode { | ||
return createElement('div'); | ||
render(createElement: any): VNode { | ||
return createElement("div") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
import Vue, { VNode } from 'vue'; | ||
import { Component, Emit, Inject, Model, Prop, Provide, Watch } from '../src/nuxt-property-decorator'; | ||
import Vue, { VNode } from "vue" | ||
import { | ||
Component, | ||
Emit, | ||
Inject, | ||
Model, | ||
Prop, | ||
Provide, | ||
Watch | ||
} from "../src/nuxt-property-decorator" | ||
|
||
const s = Symbol() | ||
@Component({ | ||
provide() { | ||
return { | ||
[s]: 'one', | ||
bar: 'two' | ||
[s]: "one", | ||
bar: "two" | ||
} | ||
} | ||
}) | ||
export class Parent extends Vue { | ||
render (createElement: any): VNode { | ||
return createElement('div'); | ||
render(createElement: any): VNode { | ||
return createElement("div") | ||
} | ||
} | ||
|
||
@Component | ||
export class Child extends Vue { | ||
@Inject(s) foo: string | ||
@Inject() bar: string | ||
render (createElement: any): VNode { | ||
return createElement('div'); | ||
render(createElement: any): VNode { | ||
return createElement("div") | ||
} | ||
} | ||
|
||
@Component | ||
export class GrandChild extends Vue { | ||
@Inject(s) foo: string | ||
@Inject() bar: string | ||
render (createElement: any): VNode { | ||
return createElement('div'); | ||
render(createElement: any): VNode { | ||
return createElement("div") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import Vue, { VNode } from 'vue'; | ||
import { Component, Model } from '../src/nuxt-property-decorator'; | ||
import Vue, { VNode } from "vue" | ||
import { Component, Model } from "../src/nuxt-property-decorator" | ||
|
||
@Component({ | ||
name: 'test' | ||
name: "test" | ||
}) | ||
export default class ModelFixture extends Vue { | ||
@Model('change') | ||
checked: boolean; | ||
render (createElement: any): VNode { | ||
return createElement('div'); | ||
@Model("change") | ||
checked: boolean | ||
render(createElement: any): VNode { | ||
return createElement("div") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,59 @@ | ||
import Vue from 'vue'; | ||
import { /*Component,*/ Emit, Inject, Model, Prop, PropSync, Provide, Watch } from "vue-property-decorator"; | ||
import Component, { mixins } from 'vue-class-component'; | ||
import 'reflect-metadata'; | ||
export declare type Constructor = { | ||
new (...args: any[]): any; | ||
}; | ||
/** | ||
* decorator of $off | ||
* @param event The name of the event | ||
* @param method The name of the method | ||
*/ | ||
export declare function Off(event?: string, method?: string): MethodDecorator; | ||
/** | ||
* decorator of $on | ||
* @param event The name of the event | ||
*/ | ||
export declare function On(event?: string): MethodDecorator; | ||
/** | ||
* decorator of $once | ||
* @param event The name of the event | ||
*/ | ||
export declare function Once(event?: string): MethodDecorator; | ||
/** | ||
* decorator of $nextTick | ||
* | ||
* @export | ||
* @param {string} method | ||
* @returns {MethodDecorator} | ||
*/ | ||
export declare function NextTick(method: string): MethodDecorator; | ||
import { State, Getter, Action, Mutation, namespace } from 'vuex-class'; | ||
export { Vue, Component, Emit, Inject, Model, Prop, PropSync, Provide, Watch, mixins, State, Getter, Action, Mutation, namespace }; | ||
import Vue from "vue" | ||
import { | ||
/*Component,*/ Emit, | ||
Inject, | ||
Model, | ||
Prop, | ||
PropSync, | ||
Provide, | ||
Ref, | ||
Watch | ||
} from "vue-property-decorator" | ||
import Component, { mixins } from "vue-class-component" | ||
import "reflect-metadata" | ||
export declare type Constructor = { | ||
new (...args: any[]): any | ||
} | ||
/** | ||
* decorator of $off | ||
* @param event The name of the event | ||
* @param method The name of the method | ||
*/ | ||
export declare function Off(event?: string, method?: string): MethodDecorator | ||
/** | ||
* decorator of $on | ||
* @param event The name of the event | ||
*/ | ||
export declare function On(event?: string): MethodDecorator | ||
/** | ||
* decorator of $once | ||
* @param event The name of the event | ||
*/ | ||
export declare function Once(event?: string): MethodDecorator | ||
/** | ||
* decorator of $nextTick | ||
* | ||
* @export | ||
* @param {string} method | ||
* @returns {MethodDecorator} | ||
*/ | ||
export declare function NextTick(method: string): MethodDecorator | ||
import { State, Getter, Action, Mutation, namespace } from "vuex-class" | ||
export { | ||
Vue, | ||
Component, | ||
Emit, | ||
Inject, | ||
Model, | ||
Prop, | ||
PropSync, | ||
Provide, | ||
Ref, | ||
Watch, | ||
mixins, | ||
State, | ||
Getter, | ||
Action, | ||
Mutation, | ||
namespace | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import typescript from "rollup-plugin-typescript2" | ||
|
||
export default { | ||
input: './src/nuxt-property-decorator.ts', | ||
plugins: [ | ||
typescript({ | ||
tsconfig: './tsconfig.json' | ||
input: "./src/nuxt-property-decorator.ts", | ||
plugins: [ | ||
typescript({ | ||
tsconfig: "./tsconfig.json" | ||
}) | ||
], | ||
output:{ | ||
format: 'umd', | ||
name: 'NuxtPropertyDecorator', | ||
file: 'lib/nuxt-property-decorator.umd.js', | ||
globals: { | ||
'vue': 'Vue', | ||
'vuex-class': 'VuexClass', | ||
'vue-class-component': 'VueClassComponent', | ||
'vue-property-decorator': 'VuePropertyDecorator' | ||
} | ||
}, | ||
external: [ | ||
'vue', 'vuex-class', 'vue-property-decorator', 'vue-class-component', 'reflect-metadata' | ||
] | ||
], | ||
output: { | ||
format: "umd", | ||
name: "NuxtPropertyDecorator", | ||
file: "lib/nuxt-property-decorator.umd.js", | ||
globals: { | ||
vue: "Vue", | ||
"vuex-class": "VuexClass", | ||
"vue-class-component": "VueClassComponent", | ||
"vue-property-decorator": "VuePropertyDecorator" | ||
} | ||
}, | ||
external: [ | ||
"vue", | ||
"vuex-class", | ||
"vue-property-decorator", | ||
"vue-class-component", | ||
"reflect-metadata" | ||
] | ||
} |
Oops, something went wrong.