Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正 html 标签名不合法的隐患问题 #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/assets/data/empty.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"props": {},
"child": [{
"id": "truck/richtextj0n4g65h",
"id": "ymm-truck-richtextj0n4g65h",
"type": "truck/richtext",
"label": "初次见面,请移除我",
"visible": true,
Expand Down Expand Up @@ -41,4 +41,4 @@
"path": "https://ymm-maliang.oss-cn-hangzhou.aliyuncs.com/truck/emptyContainer/1.0.2/index.js",
"events": [],
"label": "root"
}
}
2 changes: 1 addition & 1 deletion src/components/Node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
this.slots = this.calcSlots(component, this.nodeInfo.props)
let type = this.nodeInfo.type
// 如果有label(用户设置 || getbasenode设置 || 这里设置)保留,否则从component配置对象获取,否则用id
that.$set(that.info, 'label', that.info.label ? that.info.label : that.info.id.replace(type, (component && component.label) || type))
that.$set(that.info, 'label', that.info.label ? that.info.label : that.info.id.replace(`ymm-${type.replace(/\//g, '-')}`, (component && component.label) || type))
that.$set(that.info, 'stack', (() => {
// 设置过了
if (typeof that.info.stack === 'boolean') return that.info.stack
Expand Down
4 changes: 2 additions & 2 deletions src/extend/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function getBaseNode (node) {
if (!node.id) return
useComponent(node.id)
var info = {
id: node.name,
id: `ymm-${node.name.replace(/\//g, '-')}`,
type: node.name,
label: node.label,
version: node.version,
Expand All @@ -83,7 +83,7 @@ function getBaseNode (node) {
top: '0px'
}, node.style)
}
var idCache = Object.keys(window.$_nodecomponents || {}).concat([node.name])
var idCache = Object.keys(window.$_nodecomponents || {}).concat([info.id])
info = modifyNodeId(info, idCache)
if (info.label) info.label = info.id.replace(node.id, info.label) // 给label添加id
return info
Expand Down