1.0.0-beta.21 (2020-12-07)
1.0.0-beta.20 (2020-11-24)
1.0.0-beta.19 (2020-11-02)
- types: allow any custom options for defineComponent, fix #579 (#584) (7cdf1e5)
- types: attrs in SetupContext fix#562 (#582) (2d6de26)
- types: this type in data(), fix #570 (#576) (9a5b438)
1.0.0-beta.18 (2020-10-21)
- type: vue constructor should not require props with default values (#567) (964f9f3)
- better
vueDependency
importing, close #564 (#572) (555f20a)
1.0.0-beta.17 (2020-10-17)
-
watch APIs now default to use
flush: 'pre'
instead offlush: 'post'
.-
Check https://github.com/vuejs/vue-next/commit/49bb44756fda0a7019c69f2fa6b880d9e41125aa
-
This change affects
watch
,watchEffect
, thewatch
component option, andthis.$watch
. -
As pointed out by @skirtles-code in
-
1.0.0-beta.16 (2020-10-10)
- SSR: value set for props, fix #550 (#551) (5b1b094)
- add emits options to defineComponent(fix #553) (#554) (e44311f)
1.0.0-beta.15 (2020-10-04)
- reactive: fix issue when using reactive
array
in the template (#532) (d99b91d) reactive
in SSR (#546) (535c829)- incorrect warning for
getRegisteredVueOrDefault
, resolve #544 (3a1d992) - reactive for props (#547) (4d39443)
- vue-test: prevent warning when using multiple
localVue
(#531) (5484bb7)
1.0.0-beta.14 (2020-09-15)
1.0.0-beta.13 (2020-09-12)
1.0.0-beta.12 (2020-09-12)
- allow plugin to be installed in localVue (#497) (07be9d7)
- improve reactive checks (#502) (255dc72)
- inject: add
treatDefaultAsFactory
argument (#503) (78592bf)
1.0.0-beta.11 (2020-08-22)
- setup: handle updates for directly return a reactive object (#488) (a7f2c25), closes #487
- watch: check if ob has value before addSub (#477) (d8cd30d)
1.0.0-beta.10 (2020-08-15)
1.0.0-beta.9 (2020-08-11)
1.0.0-beta.8 (2020-08-07)
1.0.0-beta.7 (2020-08-07)
- template auto ref unwrapping are now applied shallowly, i.e. only at the root level. See vuejs/core#1682 for more details.
1.0.0-beta.6 (2020-07-22)
1.0.0-beta.5 (2020-07-20)
1.0.0-beta.4 (2020-07-18)
- IE11: replace
startsWith
to be IE11 compatible (#442) (b31c74a) - type: fix tying issues in #428 (#444) (98c7041)
1.0.0-beta.3 (2020-07-09)
1.0.0-beta.2 (2020-07-05)
- prevent multiple plugins get installed (#427) (94d4d87)
- remove "browser" field in package.json (#424) (4ebeda4)
- toRaw typo (#429) (9468f72)
1.0.0-beta.1 (2020-06-30)
- change umd exported name to
VueCompositionAPI
(#399) - rename
createElement
toh
(#400) - drop
createComponent
(#389) - match dist file naming with vue-next (#413)
- unwrapRef: copy ob and make toRaw work in props (#409) (5f23886), closes #392
- nextTick await (#414) (85ffede)
- type: accept undefined return for setup() (#417) (64b16ff)
0.6.7 (2020-06-24)
- toRefs: do not warn when toRefs is called in a prop value (#405) (048b6d3)
- type: improve defineComponent type for option apis (#406) (1c64108)
0.6.6 (2020-06-21)
0.6.5 (2020-06-19)
- watchEffect: prevent recursive calls when using
flush:sync
(#389) (f7f1e77) - not unwrapping
markRaw
objects (#386) (575d100) - unwrap refs returned by
data
(#387) (1f07075)
0.6.4 (2020-06-16)
- setup: call stack exceeded when returning circular dependency (#380) (66f58ba)
- setup: Vue.extend(Comp).extend({}) - vue-test-utils (#383) (ce932bf)
0.6.3 (2020-06-12)
0.6.2 (2020-06-11)
- reactivity: unwrap nested refs on the template (#361) (1fd48f5)
- defineComponent() with array props (#364) (d7048d4)
- setup: Allow retuning frozen objects on the setup (#366) (bca3a69)
- mark props as reactive (#359) (bc78428)
__DEV__
is not defined, #355, @yoyo930021
Great thanks to @pikax for #311, making most of the APIs better aligned with the latest vue-next.
- The
lazy
option ofwatch
has been replaced by the oppositeimmediate
option, which defaults to false. (It's ignored when using the effect signature). more details (#266) - Rename
nonReactive
tomarkRaw
watchEffect
now follows the same behaviour as v3 (triggers immediately).UnwrapRef
types fromvue-next
this can cause some incompatibilities.
- Added missing reactivity API from vue-next, #311, @pikax
- Fix return type of
toRefs
, #315 - Fix incorrect ref typing, #344, @antfu
- Binding context vm when using function without parentheses, #148, @pikax
- computed: destroy helper vm of computed to prevent memleak, #277, @LinusBorg
- Remove the surplus Function type from PropType, #352, @pikax
- Added
unref
(#309),isReactive
(#327),toRef
(#313),UnwrapRef
(#247) - Added
shallowReactive
,shallowRef
- Added
toRaw
getCurrentInstance
available on the lifecycle hooks (onMounted
, etc)getCurrentInstance
returnsundefined
when called outside setup instead of throwing exception
- Align reactivity types with
vue-next
- New:
watchEffect
function, lingin up with the latest version of the RFC (RFC docs) (#275) - Fix:
setup
from a mixin should called before the component's own (#276) - Fix(types): Fix corner case in
UnWrapRef
internal type (#261) - types: Add
Element
to bailout types for unwrapping (#278)
- Refactor: rename
createComponent
todefineComponent
(thecreateComponent
function is still there but deprecated) #230 - Fix: correct the symbol check; fixes the compatibility issue in iOS 9 #218
- Fix: avoid accessing undeclared instance fields on type-level; fixes Vetur template type checking; fixes vue-router type compatibility #189
- Fix:
onUnmounted
should not be run ondeactivated
#217
- 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