refactor: ♻️ move nsfw functionality into root component
This commit is contained in:
parent
ae5d4d2633
commit
6823eeb92f
3 changed files with 18 additions and 22 deletions
10
src/App.vue
10
src/App.vue
|
@ -19,6 +19,9 @@ export default {
|
||||||
components: { Navigation },
|
components: { Navigation },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
nsfw: false,
|
||||||
|
isConfirmedHorny: false,
|
||||||
|
isWarn: false,
|
||||||
routes: [
|
routes: [
|
||||||
{ path: "/", name: "Home" },
|
{ path: "/", name: "Home" },
|
||||||
{ path: "/general", name: "General" },
|
{ path: "/general", name: "General" },
|
||||||
|
@ -29,6 +32,13 @@ export default {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
showWarning() {
|
||||||
|
if (!this.isConfirmedHorny) {
|
||||||
|
this.isWarn = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
confirmNsfw(input) {
|
confirmNsfw(input) {
|
||||||
this.$parent.nsfw = input;
|
this.$root.nsfw = input;
|
||||||
this.$parent.isConfirmedHorny = input;
|
this.$root.isConfirmedHorny = input;
|
||||||
this.$parent.isWarn = false;
|
this.$root.isWarn = false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<nsfw-warning v-show="isWarn">
|
<nsfw-warning v-show="$root.isWarn">
|
||||||
<template #heading>
|
<template #heading>
|
||||||
⚠️⚠️⚠️<br />
|
⚠️⚠️⚠️<br />
|
||||||
Whoa, Nelly!
|
Whoa, Nelly!
|
||||||
|
@ -15,14 +15,14 @@
|
||||||
</nsfw-warning>
|
</nsfw-warning>
|
||||||
|
|
||||||
<prose>
|
<prose>
|
||||||
<nsfw-switch id="nsfw-switch" v-model="nsfw" @change="showWarning()" />
|
<nsfw-switch id="nsfw-switch" v-model="$root.nsfw" @change="$root.showWarning()" />
|
||||||
|
|
||||||
<h2>Anatomy</h2>
|
<h2>Anatomy</h2>
|
||||||
|
|
||||||
<ref-figure>
|
<ref-figure>
|
||||||
<template #img>
|
<template #img>
|
||||||
<img
|
<img
|
||||||
v-if="nsfw"
|
v-if="$root.nsfw"
|
||||||
src="@/assets/refs/sebin-ref-body-NSFW.png"
|
src="@/assets/refs/sebin-ref-body-NSFW.png"
|
||||||
alt="Sebin Full Body Ref"
|
alt="Sebin Full Body Ref"
|
||||||
/>
|
/>
|
||||||
|
@ -184,8 +184,8 @@
|
||||||
</div>
|
</div>
|
||||||
<nsfw-switch
|
<nsfw-switch
|
||||||
id="nsfw-switch-muscle"
|
id="nsfw-switch-muscle"
|
||||||
v-model="nsfw"
|
v-model="$root.nsfw"
|
||||||
@change="showWarning()"
|
@change="$root.showWarning()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
@ -339,21 +339,7 @@ export default {
|
||||||
DataTable,
|
DataTable,
|
||||||
RefGallery,
|
RefGallery,
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
nsfw: false,
|
|
||||||
isWarn: false,
|
|
||||||
isConfirmedHorny: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mixins: [Sebin, Helper],
|
mixins: [Sebin, Helper],
|
||||||
methods: {
|
|
||||||
showWarning() {
|
|
||||||
if (!this.isConfirmedHorny) {
|
|
||||||
this.isWarn = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue