Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom terminal directive with global mixin #2366

Merged
merged 2 commits into from Feb 20, 2016

Conversation

rhyzx
Copy link

@rhyzx rhyzx commented Feb 19, 2016

Repo: https://jsfiddle.net/rhyzx/qdyq4z7z/2/

This is because Vue will replace old options with new one instead of extending exist options when mixin(), so compiler will get an outdated reference of directives definition object.

@@ -627,7 +628,8 @@ function makeTerminalNodeLinkFn (el, dirName, value, options, def) {
filters: parsed.filters,
raw: value,
// either an element directive, or if/for
def: def || publicDirectives[dirName]
// #2366 or custom terminal directive
def: def || publicDirectives[dirName] || Vue.options.directives[dirName]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this should actually be def || resolveAsset(options, 'directives', dirName) so that:

  1. We don't need to import Vue here (feels dirty)
  2. We reuse the same asset resolution logic (auto warnings if no directive found)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rhyzx rhyzx force-pushed the fix-terminal-directives-with-global-mixin branch from 629fe67 to 97b82f8 Compare February 20, 2016 02:10
yyx990803 added a commit that referenced this pull request Feb 20, 2016
…al-mixin

Fix custom terminal directive with global mixin
@yyx990803 yyx990803 merged commit fdf1b8d into vuejs:dev Feb 20, 2016
@rhyzx rhyzx deleted the fix-terminal-directives-with-global-mixin branch February 20, 2016 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants