Skip to content

Commit cbbe789

Browse files
committed
fix unbind
1 parent 31aeb1b commit cbbe789

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

demo/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
presets: [
3-
'@vue/app'
3+
["@babel/env", {"modules": false} ],
44
],
55
"plugins": [
66
"transform-vue-jsx",

index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
module.exports = {
2-
install: function install(Vue) {
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.default = {
7+
install: function install(Vue) {
38
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
49

510
Vue.directive(options.name || 'ref', {
@@ -10,9 +15,9 @@ module.exports = {
1015
binding.value(vnode.componentInstance || el, vnode.key);
1116
},
1217
unbind: function unbind(el, binding, vnode) {
13-
if (!el.parentNode && !el.parentElement) {
18+
Vue.nextTick(function(){
1419
binding.value(null, vnode.key);
15-
}
20+
})
1621
}
1722
});
1823
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-ref",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"title": "Vue Ref",
55
"description": "use the callback to get a reference like react",
66
"keywords": [

0 commit comments

Comments
 (0)