Skip to content

Commit fdf1b8d

Browse files
committed
Merge pull request #2366 from rhyzx/fix-terminal-directives-with-global-mixin
Fix custom terminal directive with global mixin
2 parents aa29ae4 + 97b82f8 commit fdf1b8d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/compiler/compile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ function makeTerminalNodeLinkFn (el, dirName, value, options, def) {
627627
filters: parsed.filters,
628628
raw: value,
629629
// either an element directive, or if/for
630-
def: def || publicDirectives[dirName]
630+
// #2366 or custom terminal directive
631+
def: def || resolveAsset(options, 'directives', dirName)
631632
}
632633
// check ref for v-for and router-view
633634
if (dirName === 'for' || dirName === 'router-view') {

test/unit/specs/compiler/compile_spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,4 +634,17 @@ describe('Compile', function () {
634634
expect(el.textContent).toBe('worked!')
635635
expect(getWarnCount()).toBe(0)
636636
})
637+
638+
it('allow custom terminal directive', function () {
639+
Vue.mixin({}) // #2366 conflict with custom terminal directive
640+
Vue.compiler.terminalDirectives.push('foo')
641+
Vue.directive('foo', {})
642+
643+
new Vue({
644+
el: el,
645+
template: '<div v-foo></div>'
646+
})
647+
648+
expect(getWarnCount()).toBe(0)
649+
})
637650
})

0 commit comments

Comments
 (0)