Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Computed is not defined

I've got a error where computed is not defined, I can't seem to find how to solve this, even after placing it in computed: {}

<template>
  <component :is="tag" v-html="sanitizedContent" />
</template>
<script>
import { defineComponent } from "@nuxtjs/composition-api";

import DOMPurify from "isomorphic-dompurify";

export default defineComponent({
  name: "HTMLContent",
  sanitizedContent: computed(() => DOMPurify.sanitize(props.content)),
  props: {
    tag: {
      type: String,
      default: "div",
    },
    content: {
      type: String,
      default: "",
    },
  },
});
</script>
like image 983
Craws Avatar asked Feb 11 '26 03:02

Craws


1 Answers

Did you try to import it:

import { computed } from "vue";

and:

const sanitizedContent = computed(() => DOMPurify.sanitize(props.content))
like image 103
Nikola Pavicevic Avatar answered Feb 13 '26 17:02

Nikola Pavicevic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!