One file, three parts
A .pzl file holds up to three parts:
<puzzle-view>is the template, the markup this file renders.<script>exports the class that owns it. Itsdata()returns the values the template can read.<style scoped>styles this file's markup.
Curly braces print a value, so { heading } prints the heading key that data() returns. Every data() in this tutorial is written data(params, props): the route's parameters and the props a parent passed in. Home uses neither yet.
Your turn
- In
data(), replacemessagewith ataglineof your own, such as'Albums worth a second listen.'. - In the template, print
{ tagline }where{ message }was. - Add a third part at the end of the file, a style block that only this view sees:
<style scoped>
h1 {
font-family: Georgia, 'Times New Roman', serif;
font-weight: 400;
}
</style>
The template never says this. Every name in it comes from data(), or is a display function such as currency() or pluralize().