Skip to content

Releases: vuejs/composition-api

v0.6.1

08 Jun 15:04
Compare
Choose a tag to compare

Fix

v0.6.0

08 Jun 12:46
7358f0d
Compare
Choose a tag to compare

Great thanks to @pikax for #311, making most of the APIs better aligned with the latest vue-next.

BREAKING CHANGE

  • The lazy option of watch has been replaced by the opposite immediate option, which defaults to false. (It's ignored when using the effect signature). more details (#266)
  • Rename nonReactive to markRaw
  • watchEffect now follows the same behaviour as v3 (triggers immediately).
  • UnwrapRef types from vue-next this can cause some incompatibilities.

Bug Fixes

  • 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

Features

  • Added unref(#309), isReactive (#327), toRef (#313), UnwrapRef (#247)
  • Added shallowReactive, shallowRef
  • Added toRaw
  • getCurrentInstance available on the lifecycle hooks (onMounted, etc)
  • getCurrentInstance returns undefined when called outside setup instead of throwing exception

Types

  • Align reactivity types with vue-next

v0.5.0

25 Mar 16:15
Compare
Choose a tag to compare
  • 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)

v0.4.0

18 Feb 12:05
5961705
Compare
Choose a tag to compare
  • Refactor: rename createComponent to defineComponent (the createComponent 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 on deactivated #217

v0.3.4

02 Dec 02:27
Compare
Choose a tag to compare
  • Fixed reactive setter not working on the server.
  • New isServer setup context property.

v0.3.3

02 Dec 01:20
Compare
Choose a tag to compare
  • Fixed make __ob__ unenumerable #149.
  • Fixed computed type.
  • Expose getCurrentInstance for advanced usage in Vue plugins
  • New onServerPrefetch lifecycle hook and new ssrContext setup context property #198

v0.3.2

19 Sep 03:10
Compare
Choose a tag to compare
  • Improve TypeScript type infer for props option #106.
  • Fix return type of createComponent not being compatible with vue-router #130.
  • Expose listeners on SetupContext #132.

v0.3.1

09 Sep 07:13
Compare
Choose a tag to compare
  • Fix cleaup callback not running when watcher stops #113.
  • Fix watcher callback not flushing at right timing #120.

v0.3.0

02 Sep 09:00
Compare
Choose a tag to compare
  • Improve TypeScript type definitions.
  • Fix context.slots not being avaliable before render #84.

Changed

The render function returned from setup no longer receives any parameters.

Previous

export default {
  setup() {
    return props => h('div', prop.msg);
  },
};

Now

export default {
  setup(props) {
    return () => h('div', prop.msg);
  },
};

v0.2.1

26 Aug 09:48
Compare
Choose a tag to compare
  • 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 with import() #81.
  • Fix inject type declaration #83.