mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-06-12 10:00:56 +08:00
优化js 内容
This commit is contained in:
parent
95ea6c2bdb
commit
5c85d2d0b3
@ -242,7 +242,13 @@
|
|||||||
|
|
||||||
for (let i = 0; i < _componentScript.length; i++) {
|
for (let i = 0; i < _componentScript.length; i++) {
|
||||||
//一段一段执行script
|
//一段一段执行script
|
||||||
eval(_componentScript[i]);
|
try{
|
||||||
|
eval(_componentScript[i]);
|
||||||
|
}catch(e){
|
||||||
|
console.log('js脚本错误',_componentScript[i]);
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化vue 对象
|
//初始化vue 对象
|
||||||
@ -374,9 +380,9 @@
|
|||||||
let componentName = _componentVcCreate.getAttribute("name");
|
let componentName = _componentVcCreate.getAttribute("name");
|
||||||
throw "组件" + componentName + "对应js 未包含 {} ";
|
throw "组件" + componentName + "对应js 未包含 {} ";
|
||||||
}
|
}
|
||||||
let newJs = _js.substring(0,position);
|
let newJs = _js.substring(0,position+1);
|
||||||
newJs = newJs + propsJs;
|
newJs = newJs + propsJs;
|
||||||
newJs = _js.substring(position + 1, _js.length);
|
newJs = newJs +_js.substring(position + 1, _js.length);
|
||||||
return newJs;
|
return newJs;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -401,7 +407,7 @@
|
|||||||
}
|
}
|
||||||
let namespace = "";
|
let namespace = "";
|
||||||
if (!_componentVcCreate.hasAttribute("namespace")) {
|
if (!_componentVcCreate.hasAttribute("namespace")) {
|
||||||
namespace = DEFAULT_NAMESPACE;
|
namespace = 'default';
|
||||||
} else {
|
} else {
|
||||||
namespace = tag.getAttributeValue("namespace");
|
namespace = tag.getAttributeValue("namespace");
|
||||||
}
|
}
|
||||||
@ -415,9 +421,9 @@
|
|||||||
let position = _js.indexOf("{");
|
let position = _js.indexOf("{");
|
||||||
let propsJs = "\nvar $namespace='" + namespace.trim() + "';\n";
|
let propsJs = "\nvar $namespace='" + namespace.trim() + "';\n";
|
||||||
|
|
||||||
let newJs = _js.substring(0,position);
|
let newJs = _js.substring(0,position+1);
|
||||||
newJs = newJs + propsJs;
|
newJs = newJs + propsJs;
|
||||||
newJs = _js.substring(position + 1, _js.length);
|
newJs = newJs+ _js.substring(position + 1, _js.length);
|
||||||
return newJs;
|
return newJs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user