prevent strange effects when switching between content_types

This commit is contained in:
Harald Bamberger
2025-09-25 16:02:43 +02:00
parent 5efad50b62
commit 2ef2948a6e
+5 -27
View File
@@ -30,39 +30,19 @@ export default {
},
data() {
return {
content_type: null,
content: null,
content_id_internal: this.content_id
};
},
methods: {
fetchContent(){
return this.$api
this.$api
.call(ApiCms.content(this.content_id_internal, this.version, this.sprache, this.sichtbar))
.then(res => {
this.content = res.data.content;
this.content_type = res.data.type;
document.querySelectorAll("#cms [data-confirm]").forEach((el) => {
el.addEventListener("click", (evt) => {
evt.preventDefault();
BsConfirm.popup(el.dataset.confirm)
.then(() => {
Axios.get(el.href)
.then((res) => {
// TODO(chris): check for success then show message and/or reload
location = location;
})
.catch((err) => console.error("ERROR:", err));
})
.catch(() => {
});
});
});
document.querySelectorAll("#cms [data-href]").forEach((el) => {
el.href = el.dataset.href.replace(
/^ROOT\//,
FHC_JS_DATA_STORAGE_OBJECT.app_root
);
this.$nextTick(function() {
this.content = res.data.content;
this.content_type = res.data.type;
});
});
}
@@ -96,8 +76,6 @@ export default {
created() {
this.fetchContent();
},
mounted() {
},
template: /*html*/ `
<!-- div that contains the content -->
<div id="fhc-cms-content" v-if="content">