\n\nMethods can access data properties via this. Call methods in templates with {{ methodName() }}.\n", "dateModified": "2026-06-20T17:11:56+00:00" } } }

LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

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: Jun 20, 2026