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