Skip to content

Commit 04f3b3a

Browse files
committed
fix(Provider): Unwrap from provider object, don't overwrite context value with undefined prop
1 parent c89a8d1 commit 04f3b3a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Provider.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
export default function Provider(context, defaultValue) {
22
return {
3-
Provider: {
4-
props: {
5-
value: {
6-
default: () => defaultValue
7-
}
8-
},
9-
created() {
3+
props: {
4+
value: {
5+
default: () => defaultValue
6+
}
7+
},
8+
created() {
9+
if (this.value !== undefined) {
1010
context.value = this.value;
11-
},
12-
watch: {
13-
value(v) {
14-
context.value = v;
15-
}
16-
},
17-
render(h) {
18-
return this.$slots.default[0];
1911
}
12+
},
13+
watch: {
14+
value(v) {
15+
context.value = v;
16+
}
17+
},
18+
render(h) {
19+
return this.$slots.default[0];
2020
}
2121
};
2222
}

0 commit comments

Comments
 (0)