From 9e29441646434d9f54a2c3e855a724633885d8a4 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 13 八月 2019 19:43:49 +0800
Subject: [PATCH] 缓存开发测试完成
---
WebService/src/main/java/com/java110/web/core/VcCreateProcessor.java | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/WebService/src/main/java/com/java110/web/core/VcCreateProcessor.java b/WebService/src/main/java/com/java110/web/core/VcCreateProcessor.java
index 916aaae..b066aef 100644
--- a/WebService/src/main/java/com/java110/web/core/VcCreateProcessor.java
+++ b/WebService/src/main/java/com/java110/web/core/VcCreateProcessor.java
@@ -134,13 +134,15 @@
attrKey = types[0].replace(" ", "")
.replace("\n", "")
.replace("\r", "");
- if (!tag.hasAttribute(attrKey)) {
+ if (!tag.hasAttribute(attrKey) && !types[1].contains("=")) {
String componentName = tag.getAttributeValue("name");
logger.error("缁勪欢" + componentName + "鏈厤缃粍浠跺睘鎬� " + attrKey);
throw new TemplateProcessingException("缁勪欢[" + componentName + "]鏈厤缃粍浠跺睘鎬�" + attrKey);
}
String vcType = tag.getAttributeValue(attrKey);
- if (types[1].contains("vc.propTypes.string")) {
+ if(!tag.hasAttribute(attrKey) && types[1].contains("=")) {
+ vcType = dealJsPropTypesDefault(types[1]);
+ }else if (types[1].contains("vc.propTypes.string")) {
vcType = "'" + vcType + "'";
}
propsJs.append("$props." + attrKey + "=" + vcType + ";\n");
@@ -157,6 +159,19 @@
return js;
}
+
+ private String dealJsPropTypesDefault(String typeValue){
+ int startPos = typeValue.indexOf("=") + 1;
+ int endPos = typeValue.length();
+ if(typeValue.contains(",")){
+ endPos = typeValue.indexOf(",");
+ }else if(typeValue.contains("//")){
+ endPos = typeValue.indexOf("//");
+ }
+
+ return typeValue.substring(startPos,endPos);
+ }
+
/**
* 澶勭悊js 鍙橀噺鍜� 鏂规硶閮藉姞鍏� 缁勪欢缂栫爜
*
--
Gitblit v1.8.0