App

Bundles

Stats
BundleMinifiedGzipBrotli
index.js51.5 kB20.2 kB18.4 kB

Source

<template>
	<input v-model.number="cFormatted" type="number" /> °c =
	<input v-model.number="fFormatted" type="number" /> °f
</template>

<script>
export default {
	data() {
		return {
			c: "",
			f: ""
		};
	},
	computed: {
		cFormatted: {
			get() {
				return this.c !== "" ? +this.c.toFixed(1) : "";
			},
			set(c) {
				this.c = c;
				this.f = +(32 + (9 / 5) * c);
			}
		},
		fFormatted: {
			get() {
				return this.f !== "" ? +this.f.toFixed(1) : "";
			},
			set(f) {
				this.f = f;
				this.c = +((5 / 9) * (f - 32));
			}
		}
	}
};
</script>
import { createApp } from "vue";
import App from "./TempConv.vue";

createApp(App).mount("#app");