Migrate some leftover vue 2 legacy code

This commit is contained in:
Ramon Wenger 2023-02-09 16:03:12 +01:00
parent 3b1d0dc256
commit b910f5216a
3 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ const resizeElement = (el: HTMLElement) => {
export default { export default {
update: resizeElement, update: resizeElement,
inserted: resizeElement, mounted: resizeElement,
created(el: HTMLElement) { created(el: HTMLElement) {
el.classList.add('skillbox-auto-grow'); el.classList.add('skillbox-auto-grow');
el.addEventListener('input', () => { el.addEventListener('input', () => {

View File

@ -1,12 +1,12 @@
const getRidOfEdges = (collection) => { const getRidOfEdges = (collection: any) => {
// todo: get rid of this, this probably doesn't work too well with immutable objects // todo: get rid of this, this probably doesn't work too well with immutable objects
// todo: don't use edges if they're not necessary // todo: don't use edges if they're not necessary
if (typeof collection === 'object' && collection && !Array.isArray(collection)) { if (typeof collection === 'object' && collection && !Array.isArray(collection)) {
let newObj = {}; const newObj: Record<string, any> = {};
for (const k in collection) { for (const k in collection) {
if (Object.prototype.hasOwnProperty.call(collection, k)) { if (Object.prototype.hasOwnProperty.call(collection, k)) {
if (k === 'edges') { if (k === 'edges') {
return collection.edges.map((edge) => getRidOfEdges(edge.node)); return collection.edges.map((edge: any) => getRidOfEdges(edge.node));
} else { } else {
newObj[k] = getRidOfEdges(collection[k]); newObj[k] = getRidOfEdges(collection[k]);
if (newObj[k]) { if (newObj[k]) {
@ -22,8 +22,8 @@ const getRidOfEdges = (collection) => {
}; };
const EdgesPlugin = { const EdgesPlugin = {
install(Vue) { install(app: any) {
Vue.prototype.$getRidOfEdges = getRidOfEdges; app.config.globalProperties.$getRidOfEdges = getRidOfEdges;
}, },
}; };

View File

@ -1,7 +1,7 @@
import flavorValues from '@/helpers/app-flavor'; import flavorValues from '@/helpers/app-flavor';
export default { export default {
install: (Vue) => { install: (app) => {
Vue.prototype.$flavor = Object.assign({}, flavorValues); app.config.globalProperties.$flavor = Object.assign({}, flavorValues);
}, },
}; };