- Fixed
reactive
setter not working on the server. - New
isServer
setup context property.
- Fixed make
__ob__
unenumerable #149. - Fixed computed type
- Expose
getCurrentInstance
for advanced usage in Vue plugins. - New
onServerPrefetch
lifecycle hook and newssrContext
setup context property #198.
- Improve TypeScript type infer for
props
option #106. - Fix return type of
createComponent
not being compatible withvue-router
#130. - Expose
listeners
onSetupContext
#132.
- Fix cleaup callback not running when watcher stops #113.
- Fix watcher callback not flushing at right timing #120.
- Improve TypeScript type definitions.
- Fix
context.slots
not being avaliable before render #84.
The render
function returned from setup
no longer receives any parameters.
export default {
setup() {
return props => h('div', prop.msg);
},
};
export default {
setup(props) {
return () => h('div', prop.msg);
},
};
-
Declare your expected prop types directly in TypeScript:
import { createComponent, createElement as h } from '@vue/composition-api'; interface Props { msg: string; } const MyComponent = createComponent < Props > { props: { msg: {}, // required by vue 2 runtime }, setup(props) { return () => h('div', props.msg); }, };
-
Declare ref type in TypeScript:
const dateRef = ref < Date > new Date();
-
Fix
createComponent
not working withimport()
#81. -
Fix
inject
type declaration #83.
computed
property is called immediately inreactive()
#79.
- rename
onBeforeDestroy()
toonBeforeUnmount()
lifecycle-hooks. - Remove
onCreated()
lifecycle-hooks. - Remove
onDestroyed()
lifecycle-hooks.
The package has been renamed to @vue/composition-api
to be consistent with RFC.
The @vue/composition-api
reflects the Composition API RFC.
- Improve typescript support.
- Export
createElement
. - Export
SetupContext
. - Support returning a render function from
setup
. - Allow string keys in
provide
/inject
.
- Remove auto-unwrapping for Array (#53).
- Export
set()
function. Using exportedset
whenever you need to use Vue.set or vm.$set. The customset
ensures that auto-unwrapping works for the new property. - Add a new signature of
provide
:provide(key, value)
. - Fix multiple
provide
invoking per component. - Fix order of
setup
invoking. onErrorCaptured
not triggered (#25).- Fix
this
losing in nested setup call (#38). - Fix some edge cases of unwarpping.
- Change
context.slots
's value. It now proxies to$scopeSlots
instead of$slots
.
- watch callback is called repeatedly with multi-sources
- reduce
watch()
memory overhead
Implement the newest version of RFC
this
is not available inside setup()
. See setup for details.
Complex Prop Types:
import { createComponent, PropType } from 'vue';
createComponent({
props: {
options: (null as any) as PropType<{ msg: string }>,
},
setup(props) {
props.options; // { msg: string } | undefined
},
});
Implement the init version of RFC