evcc-io/assets/js/components/Config/DeviceModal/YamlEntry.vue
Maschga 4c73cbe197
chore: Typescript: Rewrite views (#21714)
Co-authored-by: Michael Geers <michael@geers.tv>
2025-08-05 17:56:39 +00:00

56 lines
1.2 KiB
Vue

<template>
<div>
<p>
<span>{{ $t("config.general.customHelp") + " " }}</span>
<a :href="docsLink" target="_blank">
{{ $t("config.general.docsLink") }}
</a>
</p>
<YamlEditorContainer v-model="localValue" :error-line="errorLine" />
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import YamlEditorContainer from "../YamlEditorContainer.vue";
import { docsPrefix } from "@/i18n";
import { type DeviceType } from "@/types/evcc";
export default defineComponent({
name: "YamlEntry",
components: {
YamlEditorContainer,
},
props: {
modelValue: String,
type: { type: String as () => DeviceType, required: true },
errorLine: { type: [Number, null], default: null },
},
emits: ["update:modelValue"],
data() {
return {
localValue: this.modelValue,
};
},
computed: {
docsLink() {
return `${docsPrefix()}/docs/devices/plugins#${this.type}`;
},
},
watch: {
modelValue: {
handler(newVal) {
if (this.localValue !== newVal) {
this.localValue = newVal;
}
},
immediate: true,
},
localValue: {
handler(newVal) {
this.$emit("update:modelValue", newVal);
},
},
},
});
</script>