Skip to content

Commit 8e3c577

Browse files
author
shangbin
committed
update: check vant
1 parent 6b848ea commit 8e3c577

File tree

9 files changed

+139
-142
lines changed

9 files changed

+139
-142
lines changed

src/components-v2/VCC.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ export default {
394394
z-index: 3;
395395
top: 0;
396396
background: white;
397+
overflow: scroll;
397398
}
398399

399400
#mountedEle {

src/libs/bundle-json2html-common.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const defaultOptions = {
3939
attrValueProcessor: function (a) {
4040
return a;
4141
},
42+
singleTags: [],
4243
attributeProtectArray: [] // 哪些属性的值为''但需要渲染出来,默认:如果value为''就不生成key=value,只生成key
4344
};
4445

@@ -54,6 +55,7 @@ const props = [
5455
'supressEmptyNode',
5556
'tagValueProcessor',
5657
'attrValueProcessor',
58+
'singleTags',
5759
'attributeProtectArray'
5860
];
5961

@@ -116,22 +118,22 @@ Parser.prototype.j2x = function (jObj, level) {
116118
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
117119
} else if (jObj[key] instanceof Date) {
118120
val += this.buildTextNode(jObj[key], key, '', level);
119-
} else if (key === '__children'){ // 生成子节点
121+
} else if (key === '__children') { // 生成子节点
120122
const item = jObj[key];
121123

122-
if(item instanceof Array){
123-
item.forEach(i =>{
124+
if (item instanceof Array) {
125+
item.forEach(i => {
124126
const result = this.j2x(i, level + 1);
125127
val += result.val;
126128
});
127-
} else
128-
if (typeof item === 'object') {
129-
console.info(`不应该出现的意外`);
130-
} else {
131-
val += this.buildTextNode(item, key, '', level);
132-
}
133-
}
134-
129+
} else
130+
if (typeof item === 'object') {
131+
console.info(`不应该出现的意外`);
132+
} else {
133+
val += this.buildTextNode(item, key, '', level);
134+
}
135+
}
136+
135137
else if (typeof jObj[key] !== 'object') {
136138
//premitive type
137139
const attr = this.isAttribute(key);
@@ -144,7 +146,7 @@ Parser.prototype.j2x = function (jObj, level) {
144146
if (attr) {
145147
if (typeof jObj[key] === "boolean" && jObj[key]) {
146148
attrStr += ` ${key} `;
147-
} else if(jObj[key] || this.options.attributeProtectArray.includes(key)){
149+
} else if (jObj[key] || this.options.attributeProtectArray.includes(key)) {
148150
attrStr += ' ' + key + '="' + this.options.attrValueProcessor('' + jObj[key]) + '"';
149151
} else {
150152
attrStr += ' ' + key;
@@ -167,8 +169,8 @@ Parser.prototype.j2x = function (jObj, level) {
167169
}
168170
}
169171
}
170-
171-
172+
173+
172174
else if (Array.isArray(jObj[key])) {
173175
//repeated nodes
174176
if (this.isCDATA(key)) {
@@ -234,7 +236,7 @@ function replaceCDATAarr(str, cdata) {
234236
function buildObjectNode(val, key, attrStr, level) {
235237
if (attrStr && !val.includes('<')) {
236238

237-
if (key === "img" || key === "input") {
239+
if (key === "img" || key === "a-icon" || key === "input" || (this.options.singleTags && this.options.singleTags.includes(key))) {
238240
return (this.indentate(level) + '<' + key + attrStr + '/>');
239241
}
240242

src/map/data.index.js

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

src/map/template.index.js

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

0 commit comments

Comments
 (0)