\n\nMethods can access data properties via this. Call methods in templates with {{ methodName() }}.\n", "dateModified": "2026-07-30T14:40:22+00:00" } } }

LOGBOOK

HELP

Quiz Entry - updated: 2026.07.30

How do you define methods in a Vue.js application?

You define functions in a methods object on the createApp config, where they access data via this.

<p>c = {{ c() }}</p>
<script>
Vue.createApp({
  data() {
    return { a: 3, b: 4 }
  },
  methods: {
    c: function() {
      return Math.sqrt(this.a ** 2 + this.b ** 2);
    }
  }
}).mount('#val');
</script>

Methods can access data properties via this. Call methods in templates with {{ methodName() }}.

From Quiz: WEBT / Web Frameworks and Vue.js | Updated: Jul 30, 2026