欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vuepress實(shí)現(xiàn)自定義首頁(yè)的樣式風(fēng)格

 更新時(shí)間:2022年08月11日 16:20:11   作者:zwf193071  
這篇文章主要介紹了vuepress實(shí)現(xiàn)自定義首頁(yè)的樣式風(fēng)格,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

vuepress自定義首頁(yè)的樣式風(fēng)格

如何自定義vuepress的首頁(yè)設(shè)計(jì)風(fēng)格呢?比如,我希望首頁(yè)下面的紅框內(nèi)容是可點(diǎn)擊的:

請(qǐng)看正文步驟

正文

在docs -> .vuepress下新建theme文件夾,再在theme文件夾下新建components -> Home.vue, 將vuepress -> packages -> @vuepress -> theme-default -> Home.vue的源碼拷貝至我們的Home.vue即可,

在源碼里稍做修改便能滿(mǎn)足我們的業(yè)務(wù)需求

改過(guò)后的Home.vue代碼如下所示:

<template>
  <main
    class="home"
    :aria-labelledby="data.heroText !== null ? 'main-title' : null"
  >
    <header class="hero">
      <img
        v-if="data.heroImage"
        :src="$withBase(data.heroImage)"
        :alt="data.heroAlt || 'hero'"
      >

      <h1
        v-if="data.heroText !== null"
        id="main-title"
      >
        {{ data.heroText || $title || 'Hello' }}
      </h1>

      <p
        v-if="data.tagline !== null"
        class="description"
      >
        {{ data.tagline || $description || 'Welcome to your VuePress site' }}
      </p>

      <p
        v-if="data.actionText && data.actionLink"
        class="action"
      >
        <NavLink
          class="action-button"
          :item="actionLink"
        />
      </p>
    </header>

    <div
      v-if="data.features && data.features.length"
      class="features"
    >
      <div
        v-for="(feature, index) in data.features"
        :key="index"
        class="feature"
        @click="handleClickFeature(feature.url)"
      >
        <div class="feature-cover">
          <img :alt="feature.title" :src="feature.img"/>
        </div>
        <div class="feature-body">
          <h2>{{ feature.title }}</h2>
          <p>{{ feature.details }}</p>
        </div>
      </div>
    </div>

    <Content class="theme-default-content custom" />

    <div
      v-if="data.footer"
      class="footer"
    >
      {{ data.footer }}
    </div>
  </main>
</template>



<script>
import NavLink from '@theme/components/NavLink.vue'

export default {
  name: 'Home',

  components: { NavLink },

  computed: {
    data () {
      return this.$page.frontmatter
    },

    actionLink () {
      return {
        link: this.data.actionLink,
        text: this.data.actionText
      }
    }
  },
  methods: {
    handleClickFeature(url) {
        window.location.href = url
    }
  }
}
</script>

<style lang="stylus">
.home
  padding $navbarHeight 2rem 0
  max-width $homePageWidth
  margin 0px auto
  display block
  .hero
    text-align center
    img
      max-width: 100%
      max-height 280px
      display block
      margin 3rem auto 1.5rem
    h1
      font-size 3rem
    h1, .description, .action
      margin 1.8rem auto
    .description
      max-width 35rem
      font-size 1.6rem
      line-height 1.3
      color lighten(#000, 40%)
    .action-button
      display inline-block
      font-size 1.2rem
      color #fff
      background-color $accentColor
      padding 0.8rem 1.6rem
      border-radius 4px
      transition background-color .1s ease
      box-sizing border-box
      border-bottom 1px solid darken($accentColor, 10%)
      .icon.outbound {
        color #fff
      }
      &:hover
        background-color lighten($accentColor, 10%)
  .features
    border-top 1px solid $borderColor
    padding 1.2rem 0
    margin-top 2.5rem
    display flex
    flex-wrap wrap
    align-items flex-start
    align-content stretch
    justify-content space-between
  .feature
    margin-bottom 2rem
    flex-grow 1
    flex-basis 30%
    max-width 30%
    cursor pointer
    border 1px solid $borderColor
    transition box-shadow .3s,border-color .3s
    &:hover {
      border-color transparent;
      box-shadow 0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017
    }
    .feature-cover
      height 12rem
      img
        height: 100%;
        width: 100%;
        object-fit cover
    .feature-body
      padding 0 1.2rem
    h2
      font-size 1.4rem
      font-weight 500
      border-bottom none
      padding-bottom 0
      color lighten($textColor, 10%)
    p
      color lighten($textColor, 25%)
  .footer
    padding 2.5rem
    border-top 1px solid $borderColor
    text-align center
    color lighten($textColor, 25%)

@media (max-width: $MQMobile)
  .home
    .features
      flex-direction column
    .feature
      max-width 100%
      padding 0 2.5rem

@media (max-width: $MQMobileNarrow)
  .home
    padding-left 1.5rem
    padding-right 1.5rem
    .hero
      img
        max-height 210px
        margin 2rem auto 1.2rem
      h1
        font-size 2rem
      h1, .description, .action
        margin 1.2rem auto
      .description
        font-size 1.2rem
      .action-button
        font-size 1rem
        padding 0.6rem 1.2rem
    .feature
      h2
        font-size 1.25rem
</style>

對(duì)應(yīng)首頁(yè)的README.md內(nèi)容如下所示:

---
home: true
heroText: SF
heroImage: /logo.png
tagline: 公司業(yè)務(wù)產(chǎn)品設(shè)計(jì)體系庫(kù)
actionText: 立即開(kāi)始
actionLink: http://xxx.com/service/guide/install.html
features:
  - title: SF Map Graph
    details: 提供一系列的柱狀、餅狀等組件,此外還有文字滾動(dòng)、時(shí)間軸等特殊組件.
    url: http://xxx.com/service/guide/install.html
    img: /home/graph.png
  - title: SF Map Service
    details: 提供大搜、按鈕等一系列組件,已內(nèi)置了狀態(tài)和接口功能.
    url: http://xxx.com/service/guide/install.html
    img: /home/service.png
  - title: SF Ui 
    details: 基于Vue / Ant Design Vue的UI組件庫(kù).
    url: http://xxx.com/service/guide/install.html
    img: /home/ui.png
  - title: SF Icons 
    details: 一整套公司自有的圖標(biāo)集.
    url: http://xxx.com/service/guide/icon.html
    img: /home/icon.png
footer: MIT Licensed | Copyright ? 2020-present
---

改后的首頁(yè)效果圖如下所示:

vuepress2.x修改默認(rèn)樣式的小技巧

Vuepress2.x 對(duì)樣式的設(shè)置有較大變化,點(diǎn)此查看

官方推薦使用插件@vuepress/plugin-palette 和 SCSS。對(duì)此插件未做詳細(xì)研究,使用了一種土方式。

詳解

步驟1:新建css文件,docs/.vuepress/public/css/index.css

步驟2:配置 docs/.vuepress/config.ts

步驟3:先看看官網(wǎng)詳解,也可在目錄下找到官方變量

// 日間模式
node_modules\@vuepress\theme-default\lib\client\styles\vars.scss
// 夜間模式
node_modules\@vuepress\theme-default\lib\client\styles\vars-dark.scss

步驟4:有兩種方式:

方式一:直接修改默認(rèn)變量,

默認(rèn)樣式如下:

docs/.vuepress/public/css/index.css 中修改

/* 日間模式 */
:root {
    --c-brand: #409eff;
}

新樣式

方式二:直接在開(kāi)發(fā)者工具中找到要修改的元素的css名稱(chēng),然后在 docs/.vuepress/public/css/index.css 中修改即可。如:修改右上角站點(diǎn)名的字體顏色。

/* 左上角標(biāo)題 */
.navbar .site-name {
    color: #409eff;
}

修改前

修改后

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 詳解elementUI中input框無(wú)法輸入的問(wèn)題

    詳解elementUI中input框無(wú)法輸入的問(wèn)題

    這篇文章主要介紹了詳解elementUI中input框無(wú)法輸入的問(wèn)題,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-04-04
  • Vite內(nèi)網(wǎng)ip訪(fǎng)問(wèn)2種配置方式

    Vite內(nèi)網(wǎng)ip訪(fǎng)問(wèn)2種配置方式

    這篇文章主要給大家介紹了關(guān)于Vite內(nèi)網(wǎng)ip訪(fǎng)問(wèn)的2種配置方式,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Vite具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2023-07-07
  • vue基礎(chǔ)ESLint?Prettier配置教程詳解

    vue基礎(chǔ)ESLint?Prettier配置教程詳解

    這篇文章主要介紹了vue基礎(chǔ)ESLint?Prettier配置教程詳解,本文使用VsCode?+?Vue?+?ESLint?+?Prettier?實(shí)現(xiàn)代碼格式規(guī)范?+?保存自動(dòng)修復(fù)代碼js+vue
    2022-07-07
  • vue和react項(xiàng)目中key的作用示例詳解

    vue和react項(xiàng)目中key的作用示例詳解

    這篇文章主要為大家介紹了vue和react項(xiàng)目中key的作用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-08-08
  • vue.js單頁(yè)面應(yīng)用實(shí)例的簡(jiǎn)單實(shí)現(xiàn)

    vue.js單頁(yè)面應(yīng)用實(shí)例的簡(jiǎn)單實(shí)現(xiàn)

    本篇文章主要介紹了vue.js單頁(yè)面應(yīng)用實(shí)例的簡(jiǎn)單實(shí)現(xiàn),使用單頁(yè)應(yīng)用,沒(méi)有頁(yè)面切換,就沒(méi)有白屏阻塞,可以大大提高 H5 的性能,達(dá)到接近原生的流暢體驗(yàn)。
    2017-04-04
  • Vue 中 onclick和@click區(qū)別解析

    Vue 中 onclick和@click區(qū)別解析

    這篇文章主要介紹了Vue 中 onclick和@click區(qū)別,簡(jiǎn)單點(diǎn)說(shuō)就是onclick 只能觸發(fā) js的原生方法,不能觸發(fā)vue的封裝方法,@click 只能觸發(fā)vue的封裝方法,不能觸發(fā)js的原生方法,需要的朋友可以參考下
    2024-02-02
  • Vue狀態(tài)模式實(shí)現(xiàn)窗口??抗δ?靈動(dòng)、自由, 管理后臺(tái)Admin界面)

    Vue狀態(tài)模式實(shí)現(xiàn)窗口??抗δ?靈動(dòng)、自由, 管理后臺(tái)Admin界面)

    這篇文章主要介紹了Vue狀態(tài)模式實(shí)現(xiàn)窗口??抗δ?靈動(dòng)、自由, 管理后臺(tái)Admin界面),本文通過(guò)實(shí)例代碼文字說(shuō)明給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-03-03
  • 詳解在vue使用weixin-js-sdk常見(jiàn)使用方法

    詳解在vue使用weixin-js-sdk常見(jiàn)使用方法

    這篇文章主要介紹了 詳解在vue使用weixin-js-sdk常見(jiàn)使用方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-05-05
  • Vue應(yīng)用qs插件實(shí)現(xiàn)參數(shù)格式化示例詳解

    Vue應(yīng)用qs插件實(shí)現(xiàn)參數(shù)格式化示例詳解

    這篇文章主要為大家介紹了Vue應(yīng)用qs插件實(shí)現(xiàn)參數(shù)格式化示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-09-09
  • vue.js 表格分頁(yè)ajax 異步加載數(shù)據(jù)

    vue.js 表格分頁(yè)ajax 異步加載數(shù)據(jù)

    Vue.js通過(guò)簡(jiǎn)潔的API提供高效的數(shù)據(jù)綁定和靈活的組件系統(tǒng).這篇文章主要介紹了vue.js 表格分頁(yè)ajax 異步加載數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下
    2016-10-10

最新評(píng)論