Gridsome(五):UI框架 Buefy 的使用

本文介绍了如何在Gridsome中使用Buefy UI框架,包括安装、配置和实际应用步骤。推荐使用Netlify进行部署,因其支持Push to Deploy、免费HTTPS和自定义域名等优势。
官方文档:https://buefy.org/documentation/customization/

1. 安装

cnpm install buefy

2. 配置

// 在 main.js 中添加:
import Buefy from 'buefy'
import 'buefy/dist/buefy.css'

Vue.use(Buefy)

3. 使用

  • 🌰:顶部导航栏
<template>
  <b-navbar>
    <template slot="brand">
      <b-navbar-item tag="router-link" :to="{ path: '/' }">
        <img src="../assets/images/belstar-logo.png">
      </b-navbar-item>
    </template>
    <template slot="start">
      <b-navbar-item href="/">
        Home
      </b-navbar-item>
      <b-navbar-item href="https://gridsome.org/">
        Documentation
      </b-navbar-item>
      <b-navbar-dropdown label="Blog">
        <b-navbar-item :href="edge.node.path" v-for="edge in $page.posts.edges" :key="edge.node.id">
          {{edge.node.title}}
        </b-navbar-item>
      </b-navbar-dropdown>
    </template>
  </b-navbar>
</template>

<page-query>
query {
  posts: allPost(filter: { published: { eq: true }}) {
    edges {
      node {
        id
        title
        description
        cover_image (width: 770, height: 380, blur: 10)
        path
        tags {
          id
          title
          path
        }
      }
    }
  }
}
</page-query>




如果要部署的话,推荐使用 Netlify

优势

  • Simply Push to Deploy
    • 支持热部署,只需要将代码 push 到 Git 远程仓库即可自动构建及更新。
  • Free automatic HTTPS
    • 支持自定义域名,提供免费 HTTPS ,可上传域名证书。
  • Never have to leave Terminal
    • 可在终端中操作 Netlify。



🔗:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值