Last active
February 22, 2023 09:14
-
-
Save TorbjornHoltmon/9fff759e639aff5d36387789b5f53b3d to your computer and use it in GitHub Desktop.
vue jsx test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineComponent, ref, watch } from "vue"; | |
const Wow = defineComponent({ | |
props: { | |
limit: { | |
type: Number, | |
required: false, | |
default: 12, | |
}, | |
}, | |
emits: { | |
limit: (value: any) => true, | |
}, | |
name: "NotAnon", | |
setup({ limit }, { emit }) { | |
const count = ref(0); | |
const handler = () => count.value++; | |
watch(count, () => { | |
if (count.value >= limit) { | |
console.log("Should emit"); | |
emit("limit", "its Done"); | |
} | |
}); | |
console.log(limit); | |
return () => ( | |
<button type="button" onClick={handler}> | |
Count: {count.value} | |
<div>Så kan du få la være</div> | |
</button> | |
); | |
}, | |
}); | |
export default Wow; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment