DEV Community

Joe Steinbring
Joe Steinbring

Posted on β€’ Originally published at blog.jws.app on

1

Six ways to use data binding with Vue.js

This is going to be a pretty quick post. This week, I figured that we would look at computed properties and methods.

In the above example, we are taking Date.now() and outputting it to the screen four ways:

    • Directly as {{Date.now()}}
    • As the variable time
    • As a computed value
    • As a method

What is the functional difference between them? In this case, very little. πŸ™‚

So, what if we bind to our component’s data instead of to Date.now()?

So, now the value can actually update? πŸ™‚

Please note, this is a republishing of a post that I wrote early last year, so please don't be too harsh.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs