Skip to content

Commit ec52fae

Browse files
committed
chore(playground): prefer defineModel
1 parent 7eb55fa commit ec52fae

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import { sxzz } from '@sxzz/eslint-config'
2-
export default sxzz()
2+
export default sxzz([], { vue: true })

playground/src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ console.log(jsxToString(<div className={[
1818
'foo',
1919
'bar',
2020
]} style={{ color: 'red', fontSize: '20px' }} />))
21-
`.trim()
21+
`.trim(),
2222
)
2323
let result = $ref('')
2424
+2-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
<script lang="ts" setup>
2-
defineProps<{
3-
modelValue: string
4-
}>()
5-
6-
defineEmits<{
7-
(evt: 'update:modelValue', value: string): void
8-
}>()
2+
const value = defineModel<string>()
93
</script>
104

115
<template>
126
<textarea
13-
:value="modelValue"
7+
v-model="value"
148
p-2
159
w-full
1610
max-w="800px"
@@ -19,8 +13,5 @@ defineEmits<{
1913
bg="transparent"
2014
border="~ rounded gray-200 dark:gray-700"
2115
outline="none active:none"
22-
@input="
23-
$emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)
24-
"
2516
/>
2617
</template>

playground/src/typings/auto-import.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ declare global {
2121
const createGlobalState: typeof import('@vueuse/core')['createGlobalState']
2222
const createInjectionState: typeof import('@vueuse/core')['createInjectionState']
2323
const createReactiveFn: typeof import('@vueuse/core')['createReactiveFn']
24+
const createRef: typeof import('@vueuse/core')['createRef']
2425
const createReusableTemplate: typeof import('@vueuse/core')['createReusableTemplate']
2526
const createSharedComposable: typeof import('@vueuse/core')['createSharedComposable']
2627
const createTemplatePromise: typeof import('@vueuse/core')['createTemplatePromise']
@@ -317,6 +318,7 @@ declare module 'vue' {
317318
readonly createGlobalState: UnwrapRef<typeof import('@vueuse/core')['createGlobalState']>
318319
readonly createInjectionState: UnwrapRef<typeof import('@vueuse/core')['createInjectionState']>
319320
readonly createReactiveFn: UnwrapRef<typeof import('@vueuse/core')['createReactiveFn']>
321+
readonly createRef: UnwrapRef<typeof import('@vueuse/core')['createRef']>
320322
readonly createReusableTemplate: UnwrapRef<typeof import('@vueuse/core')['createReusableTemplate']>
321323
readonly createSharedComposable: UnwrapRef<typeof import('@vueuse/core')['createSharedComposable']>
322324
readonly createTemplatePromise: UnwrapRef<typeof import('@vueuse/core')['createTemplatePromise']>

playground/src/typings/components.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @ts-nocheck
33
// Generated by unplugin-vue-components
44
// Read more: https://github.com/vuejs/core/pull/3399
5+
// biome-ignore lint: disable
56
export {}
67

78
/* prettier-ignore */

0 commit comments

Comments
 (0)