Giter Club home page Giter Club logo

nuxt-blog-front's Introduction

HTML头部标签管理:

Nuxt.js 通过 vue-meta 实现头部标签管理,在 nuxt.config.js 中的 head 配置。所有的页面都会走这个配置,如果想要修改某一页面的title,可以在 pages/**.vue 文件下,添加如下配置,这时该页面的标题就变成了“收车费”,其余页面还保持原有标题不变。

export default {
    head(){
        return {
            title:"文章详情"
        }
    }
}

动态路由

文章详情页模板,创建/pages/article/_id.vue文件,以"_"为前缀的vue文件,就是动态路由,然后在里面用 $route.params.id 接收,注意:此处的id就是 vue 文件"_"后面的名字,代码如下:

/pages/article/_id.vue:

在父组件index.vue中,使用params传递id,注意:nuxt-link组件name名:article-id,news代表文件夹的名字,id代表传递的参数;

<div class="title">
	<nuxt-link :to="{name:'article-id',params:{id:article._id}}">
        {{article.title}}
    </nuxt-link>
</div>

###整合markdown

生成目录

nuxt-blog-front's People

Contributors

hansu123 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.