Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Switch to defineModel in Vue stubs #285

Merged
merged 7 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Console/InstallsInertiaStacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ protected function installInertiaVueStack()
return [
'@inertiajs/vue3' => '^1.0.0',
'@tailwindcss/forms' => '^0.5.3',
'@vitejs/plugin-vue' => '^4.5.0',
'@vitejs/plugin-vue' => '^5.0.0',
'autoprefixer' => '^10.4.12',
'postcss' => '^8.4.31',
'tailwindcss' => '^3.2.1',
'vue' => '^3.2.41',
'vue' => '^3.4.0',
] + $packages;
});

if ($this->option('typescript')) {
$this->updateNodePackages(function ($packages) {
return [
'typescript' => '^5.0.2',
'vue-tsc' => '^1.2.0',
'vue-tsc' => '^1.8.27',
] + $packages;
});
}
Expand Down Expand Up @@ -153,7 +153,7 @@ protected function installInertiaVueSsrStack()
{
$this->updateNodePackages(function ($packages) {
return [
'@vue/server-renderer' => '^3.2.31',
'@vue/server-renderer' => '^3.4.0',
] + $packages;
});

Expand Down
9 changes: 2 additions & 7 deletions stubs/inertia-vue-ts/resources/js/Components/TextInput.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';

defineProps<{
modelValue: string;
}>();

defineEmits(['update:modelValue']);
const model = defineModel<string>({ required: true });

const input = ref<HTMLInputElement | null>(null);

Expand All @@ -21,8 +17,7 @@ defineExpose({ focus: () => input.value?.focus() });
<template>
<input
class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm"
:value="modelValue"
@input="$emit('update:modelValue', ($event.target as HTMLInputElement).value)"
v-model="model"
ref="input"
/>
</template>
13 changes: 4 additions & 9 deletions stubs/inertia-vue/resources/js/Components/TextInput.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<script setup>
import { onMounted, ref } from 'vue';

defineProps({
modelValue: {
type: String,
required: true,
},
const model = defineModel({
type: String,
required: true,
});

defineEmits(['update:modelValue']);

const input = ref(null);

onMounted(() => {
Expand All @@ -24,8 +20,7 @@ defineExpose({ focus: () => input.value.focus() });
<template>
<input
class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm"
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
v-model="model"
ref="input"
/>
</template>