M
M
Maxim2021-11-02 14:08:04
Vue.js
Maxim, 2021-11-02 14:08:04

How to properly use an interface in Vuejs?

How to display name, description , time data?
i have interface task.interface.ts

export interface TaskInterface{
    name: string
    description1: string
    time: string
}


in the component
<template lang="pug">
.task()
        .name
          | {{task.name}}
        .description
          | {{task.description}}
        .time
          | {{task.time}}
</template>
import { TaskInterface } from '@/types/task.interface'
data () {
    return {
      task: {}
},
 methods: {
    setTask (task: TaskInterface) {
      task.name = '123'
      task.description1 = '123'
      task.time = '123'
      this.task = task
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question