zl程序教程

您现在的位置是:首页 >  前端

当前栏目

[Nuxt] Build a Navigation Component in Vue.js and Use in a Nuxt Layout

VueJS in and use build Component layout
2023-09-14 09:00:51 时间

You can isolate parts of templates you want to re-use into components, but you can also reuse those components across pages using layouts. This lesson walks you through creation a navigation component then extracting it out into the default layout.

 

layout/default.vue:

<template>
  <div>
    <navigation></navigation>
    <nuxt/>
  </div>
</template>
<script>
  import navigation from '~components/navigation'

  export default {
    components: {
      navigation
    }
  }
</script>