Explorar o código

slots should have highest compilation priority (fix #2163)

Evan You %!s(int64=10) %!d(string=hai) anos
pai
achega
7fd665ff83
Modificáronse 2 ficheiros con 24 adicións e 1 borrados
  1. 1 1
      src/directives/priorities.js
  2. 23 0
      test/unit/specs/misc_spec.js

+ 1 - 1
src/directives/priorities.js

@@ -5,6 +5,6 @@ export const TRANSITION = 1100
 export const EL = 1500
 export const COMPONENT = 1500
 export const PARTIAL = 1750
-export const SLOT = 1750
 export const FOR = 2000
 export const IF = 2000
+export const SLOT = 2100

+ 23 - 0
test/unit/specs/misc_spec.js

@@ -445,4 +445,27 @@ describe('Misc', function () {
     })
     expect(vm.$el.firstChild.className).toBe('outer-hi')
   })
+
+  // #2163
+  it('slot compilation order with v-if', function () {
+    var vm = new Vue({
+      el: document.createElement('div'),
+      template:
+        '<test>' +
+          '<div slot="one">slot1</div>' +
+          'default content' +
+        '</test>',
+      components: {
+        test: {
+          template:
+            '<div>' +
+              '<slot v-if="true"></slot> ' +
+              '<slot name="one"></slot>' +
+            '</div>',
+          replace: true
+        }
+      }
+    })
+    expect(vm.$el.textContent).toBe('default content slot1')
+  })
 })