App.vue
main.js
 
<template>
  <h2>Example computed Option</h2>
  <p>Using the 'btnText' computed value inside the computed option to show the appropriate button text:</p>
  <button v-on:click="this.showMsg = !this.showMsg">
    {{ btnText }}
  </button>
  <pre v-show="showMsg">{{ msg }}</pre>
</template>

<script>
export default {
  data() {
    return {
      msg: 'Hello World!',
      showMsg: false
    };
  },
  computed: {
    btnText() {
      if( this.showMsg ) {
        return 'Hide'
      }
      else {
        return 'Show'
      }
    }
  }
};
</script>

<style>
pre {
  background-color: lightgreen;
}
</style>                  
import { createApp } from 'vue'

import App from './App.vue'

const app = createApp(App)
app.mount('#app')
                  
http://localhost:5173/