diff --git a/package.json b/package.json
index b4f05c1..6f819ab 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "anot",
- "version": "1.0.4",
+ "version": "1.0.5",
"description": "Anot - 迷你mvvm框架",
"main": "dist/anot.js",
"files": [
diff --git a/src/00-generate.js b/src/00-generate.js
index cedf88e..f9e3f3b 100644
--- a/src/00-generate.js
+++ b/src/00-generate.js
@@ -12,7 +12,7 @@ var DOC = window.document
var head = DOC.head //HEAD元素
head.insertAdjacentHTML(
'afterBegin',
- ''
+ ''
)
var ifGroup = head.firstChild
diff --git a/src/15-component.js b/src/15-component.js
index 7987f8e..44e678f 100644
--- a/src/15-component.js
+++ b/src/15-component.js
@@ -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)) {