Skip to content

Commit 83f52bc

Browse files
committed
Merge branch 'dev'
2 parents 63e54eb + b136d39 commit 83f52bc

File tree

8 files changed

+38
-48
lines changed

8 files changed

+38
-48
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ node_modules
77
coverage
88
dist
99
built
10-
*.tgz0.
11-
sample_app
10+
vue-typescript*.tgz
11+
sample_app

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ roadmap.yml
77
logs
88
*.log
99
npm-debug.log*
10-
*.tgz
10+
vue-typescript*.tgz
11+
sample_app
1112
tsconfig.json
1213
sample_app

lib/vuecomponent.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
export declare function VueComponent(element: string): any;
22
export declare function VueComponent(options: vuejs.ComponentOption): any;
33
export declare function VueComponent(element: string, options: vuejs.ComponentOption): any;
4-
export declare class RegisteredComponents {
5-
private static constructors;
6-
static registerComponent(name: string, constructor: any): void;
7-
static getComponent(name: string): any;
8-
}

lib/vuecomponent.js

Lines changed: 8 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/vuecomponent.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-typescript",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Typescript decorators to make vue play nice with typescript",
55
"main": "lib/index.js",
66
"scripts": {

src/vuecomponent.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function createDecorator(name?:string, options?:vuejs.ComponentOption){
9494
}
9595

9696
for (key in options.props) {
97-
if (options.data[key]) {
97+
if (options.data[key] != null && options.data[key] != undefined) {
9898
if (!options.props[key]) options.props[key] = {};
9999
options.props[key].default = options.data[key];
100100
delete options.data[key];
@@ -107,22 +107,14 @@ function createDecorator(name?:string, options?:vuejs.ComponentOption){
107107

108108
var data = options.data;
109109
options.data = function() {return data}
110-
RegisteredComponents.registerComponent(name, Vue.component(name, options));
110+
Vue.component(name, options);
111111

112112
// the new constructor behaviour
113-
var f:()=>void = function () {
114-
return RegisteredComponents.getComponent(name);
115-
}
116-
return f;
113+
// var f:()=>void = function () {
114+
// return Vue.component(name);
115+
// }
116+
// return f;
117+
return Vue.component(name);
118+
117119
}
118120
}
119-
120-
export class RegisteredComponents {
121-
private static constructors = {};
122-
public static registerComponent(name:string, constructor:any){
123-
this.constructors[name] = constructor;
124-
}
125-
public static getComponent(name:string){
126-
return this.constructors[name];
127-
}
128-
};

test/vuecomponent.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { expect } from 'chai'
44
import * as Utils from './_testutils'
55

66
import { VueComponent } from '../src/vuecomponent'
7+
import { Prop } from '../src/prop'
78

89

910
describe('VueComponent', function(){
@@ -51,6 +52,16 @@ describe('VueComponent', function(){
5152
}
5253
}
5354

55+
@VueComponent({
56+
})
57+
class Navbar extends Vue {
58+
59+
@Prop
60+
inverted:boolean = false;
61+
62+
63+
}
64+
5465
describe('Decorator Calls', function(){
5566

5667
it('should be called its snakecase classname on plain decorator', function(){
@@ -114,11 +125,14 @@ describe('VueComponent', function(){
114125
describe("Class Constructor", function (){
115126

116127
it('should return a vue object', function(){
117-
var obj:any = new DataAndFunctions();
118-
expect(obj).to.have.property('options').that.has.property('name').that.equals('data-and-functions');
128+
// var obj:any = new DataAndFunctions();
129+
// console.log(DataAndFunctions);
130+
// console.log(new DataAndFunctions());
131+
expect(DataAndFunctions).to.have.property('options').that.has.property('name').that.equals('data-and-functions');
119132
});
120133

121134
});
122135

123136

137+
124138
});

0 commit comments

Comments
 (0)