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"
},
"gamutable.js": {
"file": "assets/gamutable-371e82bf.js",
"file": "assets/gamutable-c8105312.js",
"imports": [
"_vendor-f73869ed.js"
],

View file

@ -12,32 +12,39 @@ const components = {
GamuTable,
};
let i = 1;
for (const el of document.getElementsByClassName('vue-gamutable')) {
if (i === 1) {
window.app = createApp({
components,
mounted() {
app.rechargerJson = this.$refs.montableau.rechargerJson;
},
});
app.use(VuePapaParse);
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.use(VuePapaParse);
app_deux.provide('$papa', app_deux.config.globalProperties.$papa);
app_deux.mount(el);
gamutable();
onAjaxLoad(gamutable);
function gamutable() {
let i = 1;
for (const el of document.getElementsByClassName('vue-gamutable')) {
if (i === 1) {
window.app = createApp({
components,
mounted() {
app.rechargerJson = this.$refs.montableau.rechargerJson;
},
});
app.use(VuePapaParse);
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.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) {
e.preventDefault();
e.stopPropagation();