Releases: CRBroughton/vue-vscode-snippets
Releases · CRBroughton/vue-vscode-snippets
3.1.5
Full Changelog: 3.1.4...3.1.5
Add the v3model
snippet:
const title = defineModel('title', { required: true })
Updated the v3emits
snippet:
const emit = defineEmits<{
foo: [id: number]
bar: [name: string, ...rest: any[]]
}>()
Updated thev3slots
snippet:
const slots = defineSlots<{
default?: (props: { msg: string }) => any
item?: (props: { id: number }) => any
}>()
Version 3.1.4
Full Changelog: 3.1.3...3.1.4
Updated the v3emits
snippet Vue 3.3:
interface Emits {
foo: [id: number]
bar: [name: string, ...rest: any[]]
}
const emit = defineEmits<Emits>()
Added the v3slots
snippet:
interface Slots {
default?: (props: { msg: string }) => any
item?: (props: { id: number }) => any
}
const slots = defineSlots<Slots>()
Added the generic component snippet (v3-base-generic):
<script setup lang="ts" generic="T">
const props = defineProps<{
items: T[]
selected: T
}>()
</script>
<template>
<div>
</div>
</template>
<style scoped>
</style>
Version 3.1.3
New included snippets are listed below:
v3store
import type { InjectionKey } from 'vue'
import { inject, provide } from 'vue'
const store = () => {}
const storeKey: InjectionKey<ReturnType<typeof store>> = Symbol('composition-store')
export const provideStore = () => {
const state = store()
provide(storeKey, state)
return state
}
export const useStore = () => {
return inject(storeKey)!
}
Version 3.1.2
New included snippets are listed below:
v3props
interface Props {
msg: string
}
// For default values for your props, use :
// withDefaults(defineProps<Props>(), { msg: 'myDefaultValue' })}
const props = defineProps<Props>()
v3emits
interface Emits {
(e: 'change', id: number): void
(e: 'update', value: string): void
}
const emit = defineEmits<Emits>()
v3computedgetset
const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue'])
const value = computed({
get() {
return props.modelValue
},
set(value) {
emit('update:modelValue', value)
}
})
Version 3.1.1
- Composition API snippets now have the <script> section at the top of snippets.
- Pinia support now included.
Version 2.2.1
- Removed Vetur as dependency