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

[2.x] Use defineComponent in vue stubs for easier typescript setup #869

Merged
merged 1 commit into from
Aug 31, 2021
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
Use defineComponent for easier typescript setup
  • Loading branch information
studnitz committed Aug 31, 2021
commit fdf14f2ecf7ad4942cb1efa2aaeb42cfca3285c6
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/ActionMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: ['on'],
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/ActionSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
</template>

<script>
import { defineComponent } from 'vue'
import JetSectionTitle from './SectionTitle.vue'

export default {
export default defineComponent({
components: {
JetSectionTitle,
}
}
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
</template>

<script>
import { defineComponent } from 'vue'
import { Link } from '@inertiajs/inertia-vue3';

export default {
export default defineComponent({
components: {
Link,
},
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
data() {
return {
show: true,
Expand All @@ -54,5 +56,5 @@
return this.$page.props.jetstream.flash?.banner || ''
},
}
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: {
type: {
type: String,
default: 'submit',
},
}
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
emits: ['update:checked'],

props: {
Expand All @@ -28,5 +30,5 @@ export default {
},
},
},
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/ConfirmationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
</template>

<script>
import { defineComponent } from 'vue'
import Modal from './Modal.vue'

export default {
export default defineComponent({
emits: ['close'],

components: {
Expand All @@ -54,5 +55,5 @@
this.$emit('close')
},
}
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/ConfirmsPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@
</template>

<script>
import { defineComponent } from 'vue'
import JetButton from './Button.vue'
import JetDialogModal from './DialogModal.vue'
import JetInput from './Input.vue'
import JetInputError from './InputError.vue'
import JetSecondaryButton from './SecondaryButton.vue'

export default {
export default defineComponent({
emits: ['confirmed'],

props: {
Expand Down Expand Up @@ -110,5 +111,5 @@
this.form.error = '';
},
}
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/DangerButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: {
type: {
type: String,
default: 'button',
},
}
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/DialogModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
</template>

<script>
import { defineComponent } from 'vue'
import Modal from './Modal.vue'

export default {
export default defineComponent({
emits: ['close'],

components: {
Expand All @@ -46,5 +47,5 @@
this.$emit('close')
},
}
}
})
</script>
6 changes: 3 additions & 3 deletions stubs/inertia/resources/js/Jetstream/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
</template>

<script>
import { onMounted, onUnmounted, ref } from "vue";
import { defineComponent, onMounted, onUnmounted, ref } from "vue";

export default {
export default defineComponent({
props: {
align: {
default: 'right'
Expand Down Expand Up @@ -78,5 +78,5 @@ export default {
}
},
}
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/DropdownLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
</template>

<script>
import { defineComponent } from 'vue';
import { Link } from '@inertiajs/inertia-vue3';

export default {
export default defineComponent({
components: {
Link,
},
props: ['href', 'as']
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/FormSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
</template>

<script>
import { defineComponent } from 'vue'
import JetSectionTitle from './SectionTitle.vue'

export default {
export default defineComponent({
emits: ['submitted'],

components: {
Expand All @@ -37,5 +38,5 @@
return !! this.$slots.actions
}
}
}
})
</script>
7 changes: 4 additions & 3 deletions stubs/inertia/resources/js/Jetstream/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: ['modelValue'],

emits: ['update:modelValue'],
Expand All @@ -13,6 +15,5 @@
this.$refs.input.focus()
}
}
}
})
</script>

6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/InputError.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: ['message']
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/Label.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: ['value']
}
})
</script>
6 changes: 3 additions & 3 deletions stubs/inertia/resources/js/Jetstream/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
</template>

<script>
import { onMounted, onUnmounted } from "vue";
import { defineComponent, onMounted, onUnmounted } from "vue";

export default {
export default defineComponent({
emits: ['close'],

props: {
Expand Down Expand Up @@ -94,5 +94,5 @@ export default {
}[this.maxWidth]
}
}
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/NavLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
</template>

<script>
import { defineComponent } from 'vue'
import { Link } from '@inertiajs/inertia-vue3';

export default {
export default defineComponent({
components: {
Link,
},
Expand All @@ -20,5 +21,5 @@
: 'inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition'
}
}
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/ResponsiveNavLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
</template>

<script>
import { defineComponent } from 'vue';
import { Link } from '@inertiajs/inertia-vue3';

export default {
export default defineComponent({
components: {
Link,
},
Expand All @@ -26,5 +27,5 @@
: 'block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition'
}
}
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/SecondaryButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
props: {
type: {
type: String,
default: 'button',
},
}
}
})
</script>
6 changes: 4 additions & 2 deletions stubs/inertia/resources/js/Jetstream/ValidationErrors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</template>

<script>
export default {
import { defineComponent } from 'vue'

export default defineComponent({
computed: {
errors() {
return this.$page.props.errors
Expand All @@ -19,5 +21,5 @@
return Object.keys(this.errors).length > 0;
},
}
}
})
</script>
5 changes: 3 additions & 2 deletions stubs/inertia/resources/js/Jetstream/Welcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@
</template>

<script>
import { defineComponent } from 'vue'
import JetApplicationLogo from '@/Jetstream/ApplicationLogo.vue'

export default {
export default defineComponent({
components: {
JetApplicationLogo,
},
}
})
</script>
Loading