Skip to content

Commit

Permalink
fix(console): 修复Symbole作为对象key时,打印对象报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
whincwu committed Feb 20, 2019
1 parent 6dec7c9 commit 27ff599
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/panels/console/TextBlock.vue
Expand Up @@ -145,6 +145,7 @@ export default {
displayName() {
let _name = String(this.name);
if (_name.indexOf(" ") === 0) {
// 多个空白符压缩成一个,并加引号区分前后的空白符
return '"' + _name.replace(/^\s+/, " ") + '"';
} else {
return _name;
Expand Down Expand Up @@ -196,7 +197,7 @@ export default {
if (isFunction(descriptor.get) && isFunction(descriptor.set)) {
// 同时存在 getter 和 setter
return [
{ name, descriptor },
{ name: String(name), descriptor },
{
// Symbol 类型需要进行转换
name: `get ${String(name)}`,
Expand Down Expand Up @@ -238,7 +239,7 @@ export default {
];
} else {
// 不存在 getter 或 setter,那就是数据访问器了
return [{ name, descriptor }];
return [{ name: String(name), descriptor }];
}
// logger.log(name, ':', descriptor)
Expand Down Expand Up @@ -307,6 +308,11 @@ export default {
};
}
},
errorCaptured(error) {
// 在浏览器控制台输出错误原因
logger.error(error);
return false;
},
methods: {
onClickGetAccessor() {
if (!this.hasComputed) {
Expand Down

0 comments on commit 27ff599

Please sign in to comment.