Comments (1)
This is correct syntax. In Vue 3 you can define emits with the defineEmits
compiler macro. E.g.:
<script setup lang="ts">
const emit = defineEmits<{ (event: 'eventName', id: string): void }>()
</script>
<template>
<button @click="emit('eventName', 'abc')" />
</template>
You can find more information here: https://vuejs.org/guide/typescript/composition-api.html#typing-component-emits
I would keep it this way, as $emit
would probably only be used with the options API that is not the recommended default anymore with Vue 3.
from vue-vscode-snippets.
Related Issues (20)
- What about Volar? HOT 8
- Configure custom snippet for vue-script
- Volar suddenly being forced? HOT 2
- Option to change the order of template and script blocks HOT 5
- contributes.vue-vscode-snippets.language HOT 1
- ```vbase```no work
- not work with "Vue Language Features (Volar)"
- set scope
- create vbase-3-setup without scss HOT 1
- Does this extention supports all version of vue? 2 to 3? HOT 1
- Plans on adding Vue 3 class API
- At present, all the style labels are set as Sass. Could you please provide a less HOT 1
- How about vue-meta snippet? HOT 1
- Remove Vetur from extensionDependencies HOT 5
- [Request] Publish extension on open-vsx.org HOT 5
- Custom overwrite snippets
- don't work
- vprops modification suggestion HOT 1
- It will support the Volar HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-vscode-snippets.