Skip to content

Commit

Permalink
Merge pull request Tencent#169 from 695137400/dev
Browse files Browse the repository at this point in the history
增加定义全局变量,修改变量提示出错
  • Loading branch information
Maizify authored May 18, 2018
2 parents fe655ff + f4c4837 commit 76a86ed
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 238 deletions.
7 changes: 6 additions & 1 deletion src/core/core.less
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@
}

.vc-group.vc-actived {

.vc-group-detail {
display: block;
background-color: #FBF9FE;
Expand Down Expand Up @@ -532,4 +532,9 @@
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
}
.vc-cmd-prompted li{
list-style: none;
line-height: 30px;
margin-left: -20px;
}
26 changes: 19 additions & 7 deletions src/lib/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,39 @@ export function htmlEncode(text) {

export function JSONStringify(stringObject, formatOption = '\t', replaceString = 'CIRCULAR_DEPENDECY_OBJECT') {
let cache = [];
const returnStringObject = JSON.stringify(stringObject, (key, value) => {
/* const returnStringObject = JSON.stringify(stringObject, (key, value) => {
if (typeof value === 'object' && value !== null) {
if (~cache.indexOf(value)) {
return replaceString;
}
}
cache.push(value);
}
return value;
}, formatOption);
cache = null;
cache = null;*/
let returnStringObject = '{\n';
let keys = getObjAllKeys(stringObject);
for(let i = 0; i < keys.length; i ++){
let key = keys[i];
try {
returnStringObject += key + ':' + stringObject[key] + ',\n';
} catch (e) {
//console.log(e);
continue;
}
}
returnStringObject+='}';
return returnStringObject;
}

window.JSON.stringify=JSONStringify;
/**
* get an object's all keys ignore whether they are not enumerable
*/
export function getObjAllKeys(obj) {
if (!isObject(obj) && !isArray(obj)) {
return [];
}
let dontEnums = [
/* let dontEnums = [
'toString',
'toLocaleString',
'valueOf',
Expand All @@ -172,8 +184,8 @@ export function getObjAllKeys(obj) {
keys.push(key);
}
}
keys = keys.sort();
return keys;
keys = keys.sort();*/
return Object.getOwnPropertyNames(obj).sort();
}

/**
Expand Down
Loading

0 comments on commit 76a86ed

Please sign in to comment.