[build] 2.0.0-rc.5

This commit is contained in:
Evan You 2016-09-08 13:29:47 +02:00
parent 1c4ca4bc08
commit faecdb6324
8 changed files with 324 additions and 222 deletions

129
dist/vue.common.js vendored
View File

@ -1434,7 +1434,8 @@ function cloneVNodes (vnodes) {
function normalizeChildren (
children,
ns
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
@ -1446,7 +1447,7 @@ function normalizeChildren (
var last = res[res.length - 1]
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns))
res.push.apply(res, normalizeChildren(c, ns, i))
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c)
@ -1462,6 +1463,10 @@ function normalizeChildren (
if (ns) {
applyNS(c, ns)
}
// default key for nested array children (likely generated by v-for)
if (c.key == null && nestedIndex != null) {
c.key = "__vlist_" + nestedIndex + "_" + i + "__"
}
res.push(c)
}
}
@ -1533,7 +1538,8 @@ function updateListeners (
}
add(event, cur.invoker, capture)
}
} else if (Array.isArray(old)) {
} else if (cur !== old) {
if (Array.isArray(old)) {
old.length = cur.length
for (var i = 0; i < old.length; i++) old[i] = cur[i]
on[name] = old
@ -1542,6 +1548,7 @@ function updateListeners (
on[name] = old
}
}
}
for (name in oldOn) {
if (!on[name]) {
event = name.charAt(0) === '!' ? name.slice(1) : name
@ -2142,13 +2149,6 @@ function renderMixin (Vue) {
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key])
}
}
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = []
}
@ -2261,6 +2261,30 @@ function renderMixin (Vue) {
return ret
}
// renderSlot
Vue.prototype._t = function (
name,
fallback
) {
var slotNodes = this.$slots[name]
if (slotNodes) {
// warn duplicate slot usage
if (process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presense of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
)
slotNodes._rendered = true
}
// clone slot nodes on re-renders
if (this._isMounted) {
slotNodes = cloneVNodes(slotNodes)
}
}
return slotNodes || fallback
}
// apply v-bind object
Vue.prototype._b = function bindProps (
vnode,
@ -3261,7 +3285,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
get: function () { return config._isServer; }
})
Vue.version = '2.0.0-rc.4'
Vue.version = '2.0.0-rc.5'
/* */
@ -3704,7 +3728,7 @@ function createPatchFunction (backend) {
}
function createElm (vnode, insertedVnodeQueue, nested) {
var i, elm
var i
var data = vnode.data
vnode.isRootInsert = !nested
if (isDef(data)) {
@ -3735,28 +3759,32 @@ function createPatchFunction (backend) {
)
}
}
elm = vnode.elm = vnode.ns
vnode.elm = vnode.ns
? nodeOps.createElementNS(vnode.ns, tag)
: nodeOps.createElement(tag)
setScope(vnode)
if (Array.isArray(children)) {
for (i = 0; i < children.length; ++i) {
nodeOps.appendChild(elm, createElm(children[i], insertedVnodeQueue, true))
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(elm, nodeOps.createTextNode(vnode.text))
}
createChildren(vnode, children, insertedVnodeQueue)
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue)
}
} else if (vnode.isComment) {
elm = vnode.elm = nodeOps.createComment(vnode.text)
vnode.elm = nodeOps.createComment(vnode.text)
} else {
elm = vnode.elm = nodeOps.createTextNode(vnode.text)
vnode.elm = nodeOps.createTextNode(vnode.text)
}
return vnode.elm
}
function createChildren (vnode, children, insertedVnodeQueue) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; ++i) {
nodeOps.appendChild(vnode.elm, createElm(children[i], insertedVnodeQueue, true))
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text))
}
}
function isPatchable (vnode) {
while (vnode.child) {
vnode = vnode.child._vnode
@ -3954,7 +3982,7 @@ function createPatchFunction (backend) {
// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to a proper re-render.
// reset by the hot-reload-api and we need to do a proper re-render.
if (vnode.isStatic &&
oldVnode.isStatic &&
vnode.key === oldVnode.key &&
@ -4028,6 +4056,10 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
if (isDef(children)) {
var childNodes = nodeOps.childNodes(elm)
// empty element, allow client to pick up and populate children
if (!childNodes.length) {
createChildren(vnode, children, insertedVnodeQueue)
} else {
var childrenMatch = true
if (childNodes.length !== children.length) {
childrenMatch = false
@ -4050,6 +4082,7 @@ function createPatchFunction (backend) {
return false
}
}
}
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue)
}
@ -4142,9 +4175,18 @@ function createPatchFunction (backend) {
var directives = {
create: function bindDirectives (oldVnode, vnode) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
applyDirectives(oldVnode, vnode, 'bind')
var hasInsert = false
forEachDirective(oldVnode, vnode, function (def, dir) {
callHook$1(def, dir, 'bind', vnode, oldVnode)
if (def.inserted) {
hasInsert = true
}
})
if (hasInsert) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
applyDirectives(oldVnode, vnode, 'inserted')
})
}
},
update: function updateDirectives (oldVnode, vnode) {
applyDirectives(oldVnode, vnode, 'update')
@ -4164,30 +4206,45 @@ var directives = {
var emptyModifiers = Object.create(null)
function applyDirectives (
function forEachDirective (
oldVnode,
vnode,
hook
fn
) {
var dirs = vnode.data.directives
if (dirs) {
var oldDirs = oldVnode.data.directives
var isUpdate = hook === 'update' || hook === 'componentUpdated'
for (var i = 0; i < dirs.length; i++) {
var dir = dirs[i]
var def = resolveAsset(vnode.context.$options, 'directives', dir.name, true)
var fn = def && def[hook]
if (fn) {
if (isUpdate && oldDirs) {
if (def) {
var oldDirs = oldVnode && oldVnode.data.directives
if (oldDirs) {
dir.oldValue = oldDirs[i].value
}
if (!dir.modifiers) {
dir.modifiers = emptyModifiers
}
fn(def, dir)
}
}
}
}
function applyDirectives (
oldVnode,
vnode,
hook
) {
forEachDirective(oldVnode, vnode, function (def, dir) {
callHook$1(def, dir, hook, vnode, oldVnode)
})
}
function callHook$1 (def, dir, hook, vnode, oldVnode) {
var fn = def && def[hook]
if (fn) {
fn(vnode.elm, dir, vnode, oldVnode)
}
}
}
}
var baseModules = [
@ -5019,7 +5076,7 @@ var show = {
vnode = locateNode(vnode)
var transition = vnode.data && vnode.data.transition
if (value && transition && transition.appear && !isIE9) {
if (value && transition && !isIE9) {
enter(vnode)
}
var originalDisplay = el.style.display === 'none' ? '' : el.style.display
@ -5249,7 +5306,7 @@ var TransitionGroup = {
for (var i = 0; i < rawChildren.length; i++) {
var c = rawChildren[i]
if (c.tag) {
if (c.key != null) {
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
children.push(c)
map[c.key] = c
;(c.data || (c.data = {})).transition = transitionData

157
dist/vue.js vendored
View File

@ -1,5 +1,5 @@
/*!
* Vue.js v2.0.0-rc.4
* Vue.js v2.0.0-rc.5
* (c) 2014-2016 Evan You
* Released under the MIT License.
*/
@ -1441,7 +1441,8 @@ function cloneVNodes (vnodes) {
function normalizeChildren (
children,
ns
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
@ -1453,7 +1454,7 @@ function normalizeChildren (
var last = res[res.length - 1]
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns))
res.push.apply(res, normalizeChildren(c, ns, i))
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c)
@ -1469,6 +1470,10 @@ function normalizeChildren (
if (ns) {
applyNS(c, ns)
}
// default key for nested array children (likely generated by v-for)
if (c.key == null && nestedIndex != null) {
c.key = "__vlist_" + nestedIndex + "_" + i + "__"
}
res.push(c)
}
}
@ -1540,7 +1545,8 @@ function updateListeners (
}
add(event, cur.invoker, capture)
}
} else if (Array.isArray(old)) {
} else if (cur !== old) {
if (Array.isArray(old)) {
old.length = cur.length
for (var i = 0; i < old.length; i++) old[i] = cur[i]
on[name] = old
@ -1549,6 +1555,7 @@ function updateListeners (
on[name] = old
}
}
}
for (name in oldOn) {
if (!on[name]) {
event = name.charAt(0) === '!' ? name.slice(1) : name
@ -2149,13 +2156,6 @@ function renderMixin (Vue) {
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key])
}
}
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = []
}
@ -2268,6 +2268,30 @@ function renderMixin (Vue) {
return ret
}
// renderSlot
Vue.prototype._t = function (
name,
fallback
) {
var slotNodes = this.$slots[name]
if (slotNodes) {
// warn duplicate slot usage
if ("development" !== 'production') {
slotNodes._rendered && warn(
"Duplicate presense of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
)
slotNodes._rendered = true
}
// clone slot nodes on re-renders
if (this._isMounted) {
slotNodes = cloneVNodes(slotNodes)
}
}
return slotNodes || fallback
}
// apply v-bind object
Vue.prototype._b = function bindProps (
vnode,
@ -3266,7 +3290,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
get: function () { return config._isServer; }
})
Vue.version = '2.0.0-rc.4'
Vue.version = '2.0.0-rc.5'
/* */
@ -3711,7 +3735,7 @@ function createPatchFunction (backend) {
}
function createElm (vnode, insertedVnodeQueue, nested) {
var i, elm
var i
var data = vnode.data
vnode.isRootInsert = !nested
if (isDef(data)) {
@ -3742,28 +3766,32 @@ function createPatchFunction (backend) {
)
}
}
elm = vnode.elm = vnode.ns
vnode.elm = vnode.ns
? nodeOps.createElementNS(vnode.ns, tag)
: nodeOps.createElement(tag)
setScope(vnode)
if (Array.isArray(children)) {
for (i = 0; i < children.length; ++i) {
nodeOps.appendChild(elm, createElm(children[i], insertedVnodeQueue, true))
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(elm, nodeOps.createTextNode(vnode.text))
}
createChildren(vnode, children, insertedVnodeQueue)
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue)
}
} else if (vnode.isComment) {
elm = vnode.elm = nodeOps.createComment(vnode.text)
vnode.elm = nodeOps.createComment(vnode.text)
} else {
elm = vnode.elm = nodeOps.createTextNode(vnode.text)
vnode.elm = nodeOps.createTextNode(vnode.text)
}
return vnode.elm
}
function createChildren (vnode, children, insertedVnodeQueue) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; ++i) {
nodeOps.appendChild(vnode.elm, createElm(children[i], insertedVnodeQueue, true))
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text))
}
}
function isPatchable (vnode) {
while (vnode.child) {
vnode = vnode.child._vnode
@ -3961,7 +3989,7 @@ function createPatchFunction (backend) {
// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to a proper re-render.
// reset by the hot-reload-api and we need to do a proper re-render.
if (vnode.isStatic &&
oldVnode.isStatic &&
vnode.key === oldVnode.key &&
@ -4035,6 +4063,10 @@ function createPatchFunction (backend) {
if (isDef(tag)) {
if (isDef(children)) {
var childNodes = nodeOps.childNodes(elm)
// empty element, allow client to pick up and populate children
if (!childNodes.length) {
createChildren(vnode, children, insertedVnodeQueue)
} else {
var childrenMatch = true
if (childNodes.length !== children.length) {
childrenMatch = false
@ -4057,6 +4089,7 @@ function createPatchFunction (backend) {
return false
}
}
}
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue)
}
@ -4149,9 +4182,18 @@ function createPatchFunction (backend) {
var directives = {
create: function bindDirectives (oldVnode, vnode) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
applyDirectives(oldVnode, vnode, 'bind')
var hasInsert = false
forEachDirective(oldVnode, vnode, function (def, dir) {
callHook$1(def, dir, 'bind', vnode, oldVnode)
if (def.inserted) {
hasInsert = true
}
})
if (hasInsert) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
applyDirectives(oldVnode, vnode, 'inserted')
})
}
},
update: function updateDirectives (oldVnode, vnode) {
applyDirectives(oldVnode, vnode, 'update')
@ -4171,30 +4213,45 @@ var directives = {
var emptyModifiers = Object.create(null)
function applyDirectives (
function forEachDirective (
oldVnode,
vnode,
hook
fn
) {
var dirs = vnode.data.directives
if (dirs) {
var oldDirs = oldVnode.data.directives
var isUpdate = hook === 'update' || hook === 'componentUpdated'
for (var i = 0; i < dirs.length; i++) {
var dir = dirs[i]
var def = resolveAsset(vnode.context.$options, 'directives', dir.name, true)
var fn = def && def[hook]
if (fn) {
if (isUpdate && oldDirs) {
if (def) {
var oldDirs = oldVnode && oldVnode.data.directives
if (oldDirs) {
dir.oldValue = oldDirs[i].value
}
if (!dir.modifiers) {
dir.modifiers = emptyModifiers
}
fn(def, dir)
}
}
}
}
function applyDirectives (
oldVnode,
vnode,
hook
) {
forEachDirective(oldVnode, vnode, function (def, dir) {
callHook$1(def, dir, hook, vnode, oldVnode)
})
}
function callHook$1 (def, dir, hook, vnode, oldVnode) {
var fn = def && def[hook]
if (fn) {
fn(vnode.elm, dir, vnode, oldVnode)
}
}
}
}
var baseModules = [
@ -5026,7 +5083,7 @@ var show = {
vnode = locateNode(vnode)
var transition = vnode.data && vnode.data.transition
if (value && transition && transition.appear && !isIE9) {
if (value && transition && !isIE9) {
enter(vnode)
}
var originalDisplay = el.style.display === 'none' ? '' : el.style.display
@ -5256,7 +5313,7 @@ var TransitionGroup = {
for (var i = 0; i < rawChildren.length; i++) {
var c = rawChildren[i]
if (c.tag) {
if (c.key != null) {
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
children.push(c)
map[c.key] = c
;(c.data || (c.data = {})).transition = transitionData
@ -5942,7 +5999,6 @@ var preTransforms
var transforms
var postTransforms
var delimiters
var seenSlots
/**
* Convert HTML string to AST.
@ -5959,7 +6015,6 @@ function parse (
transforms = pluckModuleFunction(options.modules, 'transformNode')
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode')
delimiters = options.delimiters
seenSlots = Object.create(null)
var stack = []
var preserveWhitespace = options.preserveWhitespace !== false
var root
@ -6234,25 +6289,7 @@ function processOnce (el) {
function processSlot (el) {
if (el.tag === 'slot') {
if ("development" !== 'production') {
if (!el.attrsMap[':name'] && !el.attrsMap['v-bind:name'] && checkInFor(el)) {
warn$1(
'Static <slot> found inside v-for: they will not render correctly. ' +
'Render the list in parent scope and use a single <slot> instead.'
)
}
}
el.slotName = getBindingAttr(el, 'name')
if ("development" !== 'production') {
var name = el.slotName
if (seenSlots[name]) {
warn$1(
"Duplicate " + (name ? ("<slot> with name " + name) : "default <slot>") + " " +
"found in the same template."
)
}
seenSlots[name] = true
}
} else {
var slotTarget = getBindingAttr(el, 'slot')
if (slotTarget) {
@ -6763,11 +6800,11 @@ function genText (text) {
}
function genSlot (el) {
var slot = "$slots[" + (el.slotName || '"default"') + "]"
var slotName = el.slotName || '"default"'
var children = genChildren(el)
return children
? ("(" + slot + "||" + children + ")")
: slot
? ("_t(" + slotName + "," + children + ")")
: ("_t(" + slotName + ")")
}
function genComponent (el) {

6
dist/vue.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1599,7 +1599,8 @@ function cloneVNodes (vnodes) {
function normalizeChildren (
children,
ns
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
@ -1611,7 +1612,7 @@ function normalizeChildren (
var last = res[res.length - 1]
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns))
res.push.apply(res, normalizeChildren(c, ns, i))
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c)
@ -1627,6 +1628,10 @@ function normalizeChildren (
if (ns) {
applyNS(c, ns)
}
// default key for nested array children (likely generated by v-for)
if (c.key == null && nestedIndex != null) {
c.key = "__vlist_" + nestedIndex + "_" + i + "__"
}
res.push(c)
}
}
@ -1678,7 +1683,8 @@ function updateListeners (
}
add(event, cur.invoker, capture)
}
} else if (Array.isArray(old)) {
} else if (cur !== old) {
if (Array.isArray(old)) {
old.length = cur.length
for (var i = 0; i < old.length; i++) old[i] = cur[i]
on[name] = old
@ -1687,6 +1693,7 @@ function updateListeners (
on[name] = old
}
}
}
for (name in oldOn) {
if (!on[name]) {
event = name.charAt(0) === '!' ? name.slice(1) : name
@ -2287,13 +2294,6 @@ function renderMixin (Vue) {
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key])
}
}
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = []
}
@ -2406,6 +2406,30 @@ function renderMixin (Vue) {
return ret
}
// renderSlot
Vue.prototype._t = function (
name,
fallback
) {
var slotNodes = this.$slots[name]
if (slotNodes) {
// warn duplicate slot usage
if (process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presense of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
)
slotNodes._rendered = true
}
// clone slot nodes on re-renders
if (this._isMounted) {
slotNodes = cloneVNodes(slotNodes)
}
}
return slotNodes || fallback
}
// apply v-bind object
Vue.prototype._b = function bindProps (
vnode,
@ -3851,7 +3875,6 @@ var preTransforms
var transforms
var postTransforms
var delimiters
var seenSlots
/**
* Convert HTML string to AST.
@ -3868,7 +3891,6 @@ function parse (
transforms = pluckModuleFunction(options.modules, 'transformNode')
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode')
delimiters = options.delimiters
seenSlots = Object.create(null)
var stack = []
var preserveWhitespace = options.preserveWhitespace !== false
var root
@ -4143,25 +4165,7 @@ function processOnce (el) {
function processSlot (el) {
if (el.tag === 'slot') {
if (process.env.NODE_ENV !== 'production') {
if (!el.attrsMap[':name'] && !el.attrsMap['v-bind:name'] && checkInFor(el)) {
warn$1(
'Static <slot> found inside v-for: they will not render correctly. ' +
'Render the list in parent scope and use a single <slot> instead.'
)
}
}
el.slotName = getBindingAttr(el, 'name')
if (process.env.NODE_ENV !== 'production') {
var name = el.slotName
if (seenSlots[name]) {
warn$1(
"Duplicate " + (name ? ("<slot> with name " + name) : "default <slot>") + " " +
"found in the same template."
)
}
seenSlots[name] = true
}
} else {
var slotTarget = getBindingAttr(el, 'slot')
if (slotTarget) {
@ -4672,11 +4676,11 @@ function genText (text) {
}
function genSlot (el) {
var slot = "$slots[" + (el.slotName || '"default"') + "]"
var slotName = el.slotName || '"default"'
var children = genChildren(el)
return children
? ("(" + slot + "||" + children + ")")
: slot
? ("_t(" + slotName + "," + children + ")")
: ("_t(" + slotName + ")")
}
function genComponent (el) {

View File

@ -1,6 +1,6 @@
{
"name": "vue-server-renderer",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"description": "server renderer for Vue 2.0",
"main": "index.js",
"repository": {

View File

@ -1473,7 +1473,8 @@ function cloneVNodes (vnodes) {
function normalizeChildren (
children,
ns
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
@ -1485,7 +1486,7 @@ function normalizeChildren (
var last = res[res.length - 1]
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns))
res.push.apply(res, normalizeChildren(c, ns, i))
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c)
@ -1501,6 +1502,10 @@ function normalizeChildren (
if (ns) {
applyNS(c, ns)
}
// default key for nested array children (likely generated by v-for)
if (c.key == null && nestedIndex != null) {
c.key = "__vlist_" + nestedIndex + "_" + i + "__"
}
res.push(c)
}
}
@ -1552,7 +1557,8 @@ function updateListeners (
}
add(event, cur.invoker, capture)
}
} else if (Array.isArray(old)) {
} else if (cur !== old) {
if (Array.isArray(old)) {
old.length = cur.length
for (var i = 0; i < old.length; i++) old[i] = cur[i]
on[name] = old
@ -1561,6 +1567,7 @@ function updateListeners (
on[name] = old
}
}
}
for (name in oldOn) {
if (!on[name]) {
event = name.charAt(0) === '!' ? name.slice(1) : name
@ -2161,13 +2168,6 @@ function renderMixin (Vue) {
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key])
}
}
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = []
}
@ -2280,6 +2280,30 @@ function renderMixin (Vue) {
return ret
}
// renderSlot
Vue.prototype._t = function (
name,
fallback
) {
var slotNodes = this.$slots[name]
if (slotNodes) {
// warn duplicate slot usage
if (process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presense of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
)
slotNodes._rendered = true
}
// clone slot nodes on re-renders
if (this._isMounted) {
slotNodes = cloneVNodes(slotNodes)
}
}
return slotNodes || fallback
}
// apply v-bind object
Vue.prototype._b = function bindProps (
vnode,
@ -3636,7 +3660,6 @@ var preTransforms
var transforms
var postTransforms
var delimiters
var seenSlots
/**
* Convert HTML string to AST.
@ -3653,7 +3676,6 @@ function parse (
transforms = pluckModuleFunction(options.modules, 'transformNode')
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode')
delimiters = options.delimiters
seenSlots = Object.create(null)
var stack = []
var preserveWhitespace = options.preserveWhitespace !== false
var root
@ -3928,25 +3950,7 @@ function processOnce (el) {
function processSlot (el) {
if (el.tag === 'slot') {
if (process.env.NODE_ENV !== 'production') {
if (!el.attrsMap[':name'] && !el.attrsMap['v-bind:name'] && checkInFor(el)) {
warn$1(
'Static <slot> found inside v-for: they will not render correctly. ' +
'Render the list in parent scope and use a single <slot> instead.'
)
}
}
el.slotName = getBindingAttr(el, 'name')
if (process.env.NODE_ENV !== 'production') {
var name = el.slotName
if (seenSlots[name]) {
warn$1(
"Duplicate " + (name ? ("<slot> with name " + name) : "default <slot>") + " " +
"found in the same template."
)
}
seenSlots[name] = true
}
} else {
var slotTarget = getBindingAttr(el, 'slot')
if (slotTarget) {
@ -4457,11 +4461,11 @@ function genText (text) {
}
function genSlot (el) {
var slot = "$slots[" + (el.slotName || '"default"') + "]"
var slotName = el.slotName || '"default"'
var children = genChildren(el)
return children
? ("(" + slot + "||" + children + ")")
: slot
? ("_t(" + slotName + "," + children + ")")
: ("_t(" + slotName + ")")
}
function genComponent (el) {

View File

@ -1,6 +1,6 @@
{
"name": "vue-template-compiler",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"description": "template compiler for Vue 2.0",
"main": "index.js",
"repository": {

View File

@ -8,6 +8,6 @@ Object.defineProperty(Vue.prototype, '$isServer', {
get: () => config._isServer
})
Vue.version = '2.0.0-rc.4'
Vue.version = '2.0.0-rc.5'
export default Vue