refactor: ♻️ move v-model up one layer

This commit is contained in:
Sebin Nyshkim 2020-12-19 15:48:47 +01:00
parent 724dd3bca2
commit 80be636384
2 changed files with 12 additions and 3 deletions

View file

@ -5,7 +5,7 @@
<div> <div>
If you wish to see NSFW content on this page flip this switch. If you wish to see NSFW content on this page flip this switch.
</div> </div>
<nsfw-switch /> <nsfw-switch v-model="$parent.nsfw" />
</div> </div>
</div> </div>

View file

@ -3,7 +3,8 @@
<div>😇</div> <div>😇</div>
<div class="toggle-wrap"> <div class="toggle-wrap">
<input <input
v-model="$parent.$parent.nsfw" :checked="checked"
@change="$emit('change', $event.target.checked)"
type="checkbox" type="checkbox"
name="nsfw" name="nsfw"
id="nsfw-switch" id="nsfw-switch"
@ -15,7 +16,15 @@
</template> </template>
<script> <script>
export default {}; export default {
model: {
prop: "checked",
event: "change"
},
props: {
checked: Boolean
}
};
</script> </script>
<style lang="scss"> <style lang="scss">