-
Notifications
You must be signed in to change notification settings - Fork 845
[2.x] Upgrade VueJS to version 3 #666
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0b91ea4
upgrade node packages to Vue 3
octoper e5cf375
Removed portal-vue with Vue 3 builtin Teleport component
octoper 68217e7
add emits in modals and change value to modelValue on Input component
octoper 2a7da64
wip
octoper babdcfe
wip
octoper ad2475b
wip
octoper 1020b82
wip
octoper 961ff59
Fixed StyleCI Warnings
octoper d5dcabf
Fixed StyleCI Warnings
octoper b8f764f
fixed transitions and removed listener in Dropdown Component
octoper 65d0d4c
change modals teleport desination from modal div to the whole body
octoper b977197
bump @inertiajs/inertia to version 0.8.4
octoper 89d2b43
style changes
octoper e06cf8e
use the new Composition API for Dropdown and Modal components
octoper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ | |
import Modal from './Modal' | ||
|
||
export default { | ||
emits: ['close'], | ||
|
||
components: { | ||
Modal, | ||
}, | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ | |
import Modal from './Modal' | ||
|
||
export default { | ||
emits: ['close'], | ||
|
||
components: { | ||
Modal, | ||
}, | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
<template> | ||
<portal to="modal"> | ||
<teleport to="body"> | ||
<transition leave-active-class="duration-200"> | ||
<div v-show="show" class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50"> | ||
<transition enter-active-class="ease-out duration-300" | ||
enter-class="opacity-0" | ||
enter-from-class="opacity-0" | ||
enter-to-class="opacity-100" | ||
leave-active-class="ease-in duration-200" | ||
leave-class="opacity-100" | ||
leave-from-class="opacity-100" | ||
leave-to-class="opacity-0"> | ||
<div v-show="show" class="fixed inset-0 transform transition-all" @click="close"> | ||
<div class="absolute inset-0 bg-gray-500 opacity-75"></div> | ||
</div> | ||
</transition> | ||
|
||
<transition enter-active-class="ease-out duration-300" | ||
enter-class="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" | ||
enter-from-class="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" | ||
enter-to-class="opacity-100 translate-y-0 sm:scale-100" | ||
leave-active-class="ease-in duration-200" | ||
leave-class="opacity-100 translate-y-0 sm:scale-100" | ||
leave-from-class="opacity-100 translate-y-0 sm:scale-100" | ||
leave-to-class="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"> | ||
<div v-show="show" class="mb-6 bg-white rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto" :class="maxWidthClass"> | ||
<slot></slot> | ||
</div> | ||
</transition> | ||
</div> | ||
</transition> | ||
</portal> | ||
</teleport> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
import {onMounted, onUnmounted} from "vue"; | ||
|
||
export default { | ||
emits: ['close'], | ||
|
||
props: { | ||
show: { | ||
default: false | ||
|
@@ -42,14 +46,6 @@ | |
}, | ||
}, | ||
|
||
methods: { | ||
close() { | ||
if (this.closeable) { | ||
this.$emit('close') | ||
} | ||
} | ||
}, | ||
|
||
watch: { | ||
show: { | ||
immediate: true, | ||
|
@@ -63,18 +59,25 @@ | |
} | ||
}, | ||
|
||
created() { | ||
setup(props, {emit}) { | ||
const close = () => { | ||
if (props.closeable) { | ||
emit('close') | ||
} | ||
} | ||
|
||
const closeOnEscape = (e) => { | ||
if (e.key === 'Escape' && this.show) { | ||
this.close() | ||
if (e.key === 'Escape' && props.show) { | ||
close() | ||
} | ||
} | ||
|
||
document.addEventListener('keydown', closeOnEscape) | ||
onMounted(() => document.addEventListener('keydown', closeOnEscape)) | ||
onUnmounted(() => document.removeEventListener('keydown', closeOnEscape)) | ||
|
||
this.$once('hook:destroyed', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However we solve this in the |
||
document.removeEventListener('keydown', closeOnEscape) | ||
}) | ||
return { | ||
close, | ||
} | ||
}, | ||
|
||
computed: { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
require('./bootstrap'); | ||
|
||
// Import modules... | ||
import Vue from 'vue'; | ||
import { App as InertiaApp, plugin as InertiaPlugin } from '@inertiajs/inertia-vue'; | ||
import PortalVue from 'portal-vue'; | ||
import { createApp, h } from 'vue'; | ||
import { App as InertiaApp, plugin as InertiaPlugin } from '@inertiajs/inertia-vue3'; | ||
|
||
Vue.mixin({ methods: { route } }); | ||
Vue.use(InertiaPlugin); | ||
Vue.use(PortalVue); | ||
const el = document.getElementById('app'); | ||
|
||
const app = document.getElementById('app'); | ||
|
||
new Vue({ | ||
render: (h) => | ||
createApp({ | ||
render: () => | ||
h(InertiaApp, { | ||
props: { | ||
initialPage: JSON.parse(app.dataset.page), | ||
resolveComponent: (name) => require(`./Pages/${name}`).default, | ||
}, | ||
initialPage: JSON.parse(el.dataset.page), | ||
resolveComponent: (name) => require(`./Pages/${name}`).default, | ||
}), | ||
}).$mount(app); | ||
}) | ||
.mixin({ methods: { route } }) | ||
.use(InertiaPlugin) | ||
.mount(el); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So where does this get removed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops totally forgot about that, I will add it tommorow, this hook removed at first because the depreciation of
$once
functionbut this willbe moved in the
beforeUnmount
lifecycle hook without the$once
function