DEV Community

Yasunori Tanaka
Yasunori Tanaka

Posted on

[From May 21 to May 27] The things I knew and thought last week

[vuetify] breadcrumb generator

I want to generate Vuetify's breadcrumb automatically by URL.

Let's say it the URL is /home/company/list. The generator makes breadcrumbs like the below.

[
  {
    title: 'HOME',
    url: '/home',
  },
  {
    title: 'HOME / Companies',
    url: '/home/company/list',
  },
]

[vue] create form initializer

Almost case, I will create an initial data with an interface using TypeScript like this.

interface Data {
  id: number
  name: string
}

Vue.extend({
  data(): Data {
    return {
      id: 0,
      name: '',
    }
  }
})

But if the Data interface definition gets much more, I have to fill in all initial value for the Data because the TypeScript compiler cannot build it.

So I want to generate initial values from a Data interface. Below is an example. generator function makes initial values from the interface.

const initalValues = generator(data: Data)

// initialValues
{
  id: 0,
  name: '',
}

[js] module bundler

I'm looking into how module bundler works.

Top comments (0)