Syntax Flashcards

1
Q

What command initializes a new Nuxt application?

A

npx create-nuxt-app (project_name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which casing style is used for string templates?

A

PascalCase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which casing style is used for DOM templates?

A

kebab-case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What snippet is used to create a basic template, export, style setup for a fresh vue file?

A

“default” from the “vue” extension in VSC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you link between pages in Nuxt.js?

A

“nuxt-link” element with a “to=’/path/to/file’”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 5 things required to incorporate a component into another file?

A
  1. Create the component
  2. Name the component using “name: ComponentName” in the export object
  3. Write an import statement in the parent Vue file (i.e. import Component from ‘./partials/component’)
  4. Add it to the component object in the parent vue file
  5. Create the custom element in PascalCase within the parent Vue file’s template
    * 6. (Depending) Pass properties to the child component who receives them within a “props” object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In Nuxt.js, what are the three things necessary to add a meta tag?

A
  1. “hid”, which is used as a unique identifier
  2. “name”, which is the name of the meta tag
  3. “content”, which defines the content of that meta tag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the “head” section of nuxt.config.js do?

A

Sets up default head data for each page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In Nuxt.js, how do you overwrite default “head” data for a specific page?

A

Add a head function to the “export default” statement within the specific file and use the same “hid” property of any corresponding meta tags in the default head data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In Nuxt.js, how would you import Axios to a Vue file?

A

In the script tag, add the following import statement:

import axios from “axios”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In Nuxt.js, how do you access a variable within the data() function?

A

this.objectName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In Nuxt.js, how do you access a URL parameter and display it on the page?

A

{{ $route.params.param_name }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In Nuxt.js, how would you create a new page for each item in a list based off of a template Vue file?

A
  1. Display the list in the page using a v-for loop and :key
  2. Create a nuxt-link for each item in the list with the following syntax:
    nuxt-link :to=”‘directory’ + keyParamName”
  3. Create a subdirectory in the directory being linked to with this syntax: “_keyParamName”
  4. Create an index.vue file that will serve as the template
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In Nuxt.js, how would you run server-side only code?

A

add the following to nuxt.config.js after the headsection:
serverMiddleware: [
“~/path/to/api/middleware”
],

How well did you know this?
1
Not at all
2
3
4
5
Perfectly