Skip to content

Commit aa28ec2

Browse files
author
season
committed
bug
1 parent 7bf5966 commit aa28ec2

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsdoc-vue-component",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "A simple plugin for jsdoc (`pase vue SFC info to description`)",
55
"main": "index.js",
66
"repository": {

parse.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ function parseEvents(ast) {
192192
if (skips.indexOf(node.type) != -1) return estraverse.VisitorOption.Skip;
193193

194194
if (node.type == 'CallExpression') {
195-
if (node.callee.property.name == '$emit') {
195+
if (
196+
node.callee
197+
&& node.callee.property
198+
&& node.callee.property.name == '$emit'
199+
) {
196200
emitList.push(node);
197201
}
198202
}

test/component/login.vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import api from '../lib/api';
2+
import {getUrl} from '../lib/site';
3+
4+
/**
5+
* @vue
6+
* @exports component/login
7+
*/
8+
export default {
9+
name: 'Login',
10+
data: () => {
11+
return {
12+
username: '',
13+
password: '',
14+
};
15+
},
16+
methods: {
17+
submit() {
18+
if (!this.username.trim() || !this.password.trim()) {
19+
alert('请填写用户名密码!');
20+
return;
21+
}
22+
23+
api.postForm('api/auth/login', {
24+
username: this.username.trim(),
25+
password: this.password.trim()
26+
}).then(data => {
27+
alert ('登录成功');
28+
location.href = getUrl('/app/');
29+
}).catch(error => {
30+
alert(error.message);
31+
});
32+
}
33+
}
34+
}

test/parse.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ const path = require('path');
33
const parse = require('../parse');
44

55
const code = fs.readFileSync(path.join(__dirname, './component/test.vue'));
6-
6+
console.log('=========begin code=======')
77
console.log(parse(code));
8+
console.log('=========end code=======')
9+
10+
const code2 = fs.readFileSync(path.join(__dirname, './component/login.vue'));
11+
console.log('=========begin code2=======')
12+
console.log(parse(code2));
13+
console.log('=========end code2=======')

0 commit comments

Comments
 (0)