fix: on gere le chargement de vuejs dans un contexte spip ajax

This commit is contained in:
Christophe 2023-04-03 23:00:24 +02:00
parent 31f596c435
commit 2137409c68
3 changed files with 32 additions and 25 deletions

File diff suppressed because one or more lines are too long

2
dist/manifest.json vendored
View file

@ -3,7 +3,7 @@
"file": "assets/vendor-f73869ed.js" "file": "assets/vendor-f73869ed.js"
}, },
"gamutable.js": { "gamutable.js": {
"file": "assets/gamutable-371e82bf.js", "file": "assets/gamutable-c8105312.js",
"imports": [ "imports": [
"_vendor-f73869ed.js" "_vendor-f73869ed.js"
], ],

View file

@ -12,32 +12,39 @@ const components = {
GamuTable, GamuTable,
}; };
let i = 1; gamutable();
for (const el of document.getElementsByClassName('vue-gamutable')) { onAjaxLoad(gamutable);
if (i === 1) {
window.app = createApp({ function gamutable() {
components, let i = 1;
mounted() { for (const el of document.getElementsByClassName('vue-gamutable')) {
app.rechargerJson = this.$refs.montableau.rechargerJson; if (i === 1) {
}, window.app = createApp({
}); components,
app.use(VuePapaParse); mounted() {
app.provide('$papa', app.config.globalProperties.$papa); app.rechargerJson = this.$refs.montableau.rechargerJson;
app.mount(el); },
} else if (i === 2) { });
window.app_deux = createApp({ app.use(VuePapaParse);
components, app.provide('$papa', app.config.globalProperties.$papa);
mounted() { app.mount(el);
app_deux.rechargerJson = this.$refs.montableau_deux.rechargerJson; } else if (i === 2) {
}, window.app_deux = createApp({
}); components,
app_deux.use(VuePapaParse); mounted() {
app_deux.provide('$papa', app_deux.config.globalProperties.$papa); app_deux.rechargerJson = this.$refs.montableau_deux.rechargerJson;
app_deux.mount(el); },
});
app_deux.use(VuePapaParse);
app_deux.provide('$papa', app_deux.config.globalProperties.$papa);
app_deux.mount(el);
}
i++;
} }
i++;
} }
$('#vueGamutable').on('click', '.url_action, .url_action--ss_css', function (e) { $('#vueGamutable').on('click', '.url_action, .url_action--ss_css', function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();