| | |
| | | package com.java110.web.core; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.web.smo.impl.LoginServiceSMOImpl; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.thymeleaf.Arguments; |
| | | import org.thymeleaf.dom.*; |
| | | import org.thymeleaf.dom.Document; |
| | | import org.thymeleaf.dom.Element; |
| | | import org.thymeleaf.dom.Macro; |
| | | import org.thymeleaf.dom.Node; |
| | | import org.thymeleaf.processor.element.AbstractMarkupSubstitutionElementProcessor; |
| | | import org.thymeleaf.util.DOMUtils; |
| | | |
| | |
| | | */ |
| | | public class VueComponentElement extends AbstractMarkupSubstitutionElementProcessor { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(VueComponentElement.class); |
| | | private static Logger logger = LoggerFactory.getLogger(VueComponentElement.class); |
| | | |
| | | private static final String DIV_PROPERTY_COMPONENT = "data-component"; |
| | | |
| | | |
| | | protected VueComponentElement(String elementName) { |
| | |
| | | throw new RuntimeException("在缓存中未找到组件【"+componentName+"】"); |
| | | } |
| | | //List<Node> tmpNodes = DOMUtils.getHtml5DOMFor(new StringReader(html)).getChildren(); |
| | | List<Node> tmpNodes = DOMUtils.getLegacyHTML5DOMFor(new StringReader(html)).getChildren(); |
| | | Document tmpDoc = DOMUtils.getLegacyHTML5DOMFor(new StringReader(html)); |
| | | List<Node> tmpNodes = tmpDoc.getChildren(); |
| | | |
| | | addDataComponent(tmpDoc, componentName); |
| | | for(Node tmpNode : tmpNodes) { |
| | | nodes.add(tmpNode); |
| | | } |
| | |
| | | return nodes; |
| | | } |
| | | |
| | | /** |
| | | * 加入组件名称到 HTML中 方便定位问题 |
| | | * |
| | | * @param tmpDoc 页面节点 |
| | | * @param componentCode 组件编码 |
| | | */ |
| | | private void addDataComponent(Document tmpDoc, String componentCode) { |
| | | Element tmpElement = tmpDoc.getFirstElementChild(); |
| | | tmpElement.setAttribute(DIV_PROPERTY_COMPONENT, componentCode); |
| | | } |
| | | |
| | | @Override |
| | | public int getPrecedence() { |
| | | return 1000; |