parent
							
								
									19ccdff478
								
							
						
					
					
						commit
						b5a9ef0695
					
				| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "name": "anot",
 | 
					  "name": "anot",
 | 
				
			||||||
  "version": "1.0.4",
 | 
					  "version": "1.0.5",
 | 
				
			||||||
  "description": "Anot - 迷你mvvm框架",
 | 
					  "description": "Anot - 迷你mvvm框架",
 | 
				
			||||||
  "main": "dist/anot.js",
 | 
					  "main": "dist/anot.js",
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ var DOC = window.document
 | 
				
			||||||
var head = DOC.head //HEAD元素
 | 
					var head = DOC.head //HEAD元素
 | 
				
			||||||
head.insertAdjacentHTML(
 | 
					head.insertAdjacentHTML(
 | 
				
			||||||
  'afterBegin',
 | 
					  'afterBegin',
 | 
				
			||||||
  '<anot skip class="anot-hide"><style id="anot-style">.anot-hide{ display: none!important }</style></anot>'
 | 
					  '<anot skip class="anot-hide"><style id="anot-style">.anot-hide{ display: none!important } slot{visibility:hidden;}</style></anot>'
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
var ifGroup = head.firstChild
 | 
					var ifGroup = head.firstChild
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,12 +17,24 @@ function parseSlot(collections, vms) {
 | 
				
			||||||
  arr.forEach(function(elem) {
 | 
					  arr.forEach(function(elem) {
 | 
				
			||||||
    switch (elem.nodeType) {
 | 
					    switch (elem.nodeType) {
 | 
				
			||||||
      case 1:
 | 
					      case 1:
 | 
				
			||||||
        var slot = elem.getAttribute('slot')
 | 
					        var isSlotTag = elem.tagName === 'SLOT'
 | 
				
			||||||
 | 
					        var slotKey = null
 | 
				
			||||||
 | 
					        var isSlotAttr = elem.getAttribute('slot')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (slot) {
 | 
					        if (isSlotTag) {
 | 
				
			||||||
          obj[slot] = obj[slot] || []
 | 
					          slotKey = elem.name || elem.getAttribute('name')
 | 
				
			||||||
 | 
					        } else if (isSlotAttr) {
 | 
				
			||||||
 | 
					          slotKey = isSlotAttr
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (slotKey) {
 | 
				
			||||||
 | 
					          obj[slotKey] = obj[slotKey] || []
 | 
				
			||||||
          elem.removeAttribute('slot')
 | 
					          elem.removeAttribute('slot')
 | 
				
			||||||
          obj[slot].push(elem.outerHTML)
 | 
					          if (isSlotTag) {
 | 
				
			||||||
 | 
					            obj[slotKey].push(elem.innerHTML)
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            obj[slotKey].push(elem.outerHTML)
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          var txt = elem.outerHTML
 | 
					          var txt = elem.outerHTML
 | 
				
			||||||
          if (isWidget(elem) || /:[\w-]*=".*"/.test(txt)) {
 | 
					          if (isWidget(elem) || /:[\w-]*=".*"/.test(txt)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue