From 7f94bcaf691e086130fbfb141fa862e316a1c098 Mon Sep 17 00:00:00 2001 From: tofulm Date: Sun, 12 Feb 2023 09:06:44 +0100 Subject: [PATCH] psr --- src/gamutable.js | 49 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/src/gamutable.js b/src/gamutable.js index cae2b04..347741b 100644 --- a/src/gamutable.js +++ b/src/gamutable.js @@ -1,19 +1,19 @@ // https://vitejs.dev/config/#build-polyfillmodulepreload -import "vite/modulepreload-polyfill"; +import 'vite/modulepreload-polyfill'; // Vue -import { createApp } from "vue"; +import { createApp } from 'vue'; // if importing all is too much you can always do it manually -import GamuTable from "./components/gamuTable.vue"; -import VuePapaParse from "vue-papa-parse"; +import GamuTable from './components/gamuTable.vue'; +import VuePapaParse from 'vue-papa-parse'; const components = { GamuTable, }; let i = 1; -for (const el of document.getElementsByClassName("vue-gamutable")) { +for (const el of document.getElementsByClassName('vue-gamutable')) { if (i === 1) { window.app = createApp({ components, @@ -22,62 +22,55 @@ for (const el of document.getElementsByClassName("vue-gamutable")) { }, }); app.use(VuePapaParse); - app.provide("$papa", app.config.globalProperties.$papa); + app.provide('$papa', app.config.globalProperties.$papa); app.mount(el); } else if (i === 2) { window.app_deux = createApp({ components, mounted() { - app_deux.rechargerJson = - this.$refs.montableau_deux.rechargerJson; + app_deux.rechargerJson = this.$refs.montableau_deux.rechargerJson; }, }); app_deux.use(VuePapaParse); - app_deux.provide("$papa", app_deux.config.globalProperties.$papa); + app_deux.provide('$papa', app_deux.config.globalProperties.$papa); app_deux.mount(el); } i++; } -$("#vueGamutable").on("click", ".url_action", function (e) { - console.log("coucou"); +$('#vueGamutable').on('click', '.url_action', function (e) { + console.log('coucou'); e.preventDefault(); e.stopPropagation(); - let confirmation = $(this).data("confirm"); + let confirmation = $(this).data('confirm'); if (confirmation !== undefined) { if (!confirm(confirmation)) { return; } } - let url = $(this).attr("href"); - let id = $(this).data("id"); + let url = $(this).attr('href'); + let id = $(this).data('id'); // passer en refresh animé une éventuelle icone - if ($(this).has("i.icon, i.fa")) { - $(this) - .find("i.icon, i.fa") - .eq(0) - .replaceWith(''); + if ($(this).has('i.icon, i.fa')) { + $(this).find('i.icon, i.fa').eq(0).replaceWith(''); } - let nomBlocAjaxReload = $(this).data("ajaxreload"); - console.time("Chargement de VueJs APRES Ajax"); + let nomBlocAjaxReload = $(this).data('ajaxreload'); + console.time('Chargement de VueJs APRES Ajax'); $.ajax({ url: url, - dataType: "json", + dataType: 'json', async: true, }).done(function (retour) { - if ( - !$.isEmptyObject(retour) && - !$.isEmptyObject(retour.message_erreur) - ) { + if (!$.isEmptyObject(retour) && !$.isEmptyObject(retour.message_erreur)) { alert(retour.message_erreur); } else { if (parseInt(id) > 0) { app.rechargerJson(id); } else { - app.rechargerJson("maj"); + app.rechargerJson('maj'); } if (nomBlocAjaxReload !== undefined) { - console.log("depart reload: " + nomBlocAjaxReload); + console.log('depart reload: ' + nomBlocAjaxReload); ajaxReload(nomBlocAjaxReload, { args: { id }, callback: function () {},