[Vuejs]-How to add variables in vue and use them as a code editor?

0👍

Make your result-variable a computed property and the problem is gone:

<script>
export default {
  name: "CodeEditor",
  methods: {},
  data() {
    return {
      htmlCode: '<h1>hi</h1>',
      cssCode: '',
      jsCode: '',
    }
  },
  computed: {
    htmlandcss() {
      return this.htmlCode.concat(this.cssCode);
  }
};
</script>

Leave a comment