<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        如何使用VuePress搭建一個類型element ui文檔

        來源:懂視網 責編:小采 時間:2020-11-27 22:00:54
        文檔

        如何使用VuePress搭建一個類型element ui文檔

        如何使用VuePress搭建一個類型element ui文檔:網站成果樣式 項目書寫步驟 github地址:https://github.com/xuhuihui/dataCom 官網:http://caibaojian.com/vuepress/guide/getting-started.html 參考文章:https://www.gxlcms.com/article/156259.htm 前言:
        推薦度:
        導讀如何使用VuePress搭建一個類型element ui文檔:網站成果樣式 項目書寫步驟 github地址:https://github.com/xuhuihui/dataCom 官網:http://caibaojian.com/vuepress/guide/getting-started.html 參考文章:https://www.gxlcms.com/article/156259.htm 前言:

        網站成果樣式

        項目書寫步驟

        github地址:https://github.com/xuhuihui/dataCom

        官網:http://caibaojian.com/vuepress/guide/getting-started.html

        參考文章:https://www.gxlcms.com/article/156259.htm

        前言:我先git clone官方github,運行查看完整效果。 再根據官網介紹和參考文章,結合完整的代碼,自己一步步配置內容。最后,參考element的設計樣式,修改并增加代碼,形成一個平臺組件庫的網站。

        (1)在已有項目中安裝

        # 安裝為本地依賴項
        npm install -D vuepress
        
        # 創建一個 docs 目錄
        mkdir docs
        
        # 創建一個 markdown 文件
        echo '# Hello VuePress' > docs/README.md
        
        # 給package.json 添加一些 scripts 腳本:{
         "scripts": {
         "docs:dev": "vuepress dev docs",
         "docs:build": "vuepress build docs"
         }
        }# 運行項目
        yarn run docs:dev 

        出現顯示文檔亂碼問題,如圖所示:

        解決方式:修改md文件編碼為UTF-8

        改變md文件的內容如下:

        ---
        home: true
        actionText: 前往 →
        actionLink: /baseComponents/
        features:
        - title: 布局類組件
         details: 基本組件,為常用組件提供快速,可用的組件
        - title: 可視化組件
         details: 積累將數據可視化的業務組件
        - title: 知識庫
         details: 積累前端相關的知識,涵蓋 vue、react、koa2、nodejs 相關的知識點
        ---

        (2)配置文件

        配置(參考鏈接:http://caibaojian.com/vuepress/config/) VuePress 站點的基本文件是 .vuepress/config.js,其中導出一個 JavaScript 對象:

        module.exports = {
         title: 'data Com', // 設置網站標題
         description: 'Just for fun', //描述
         dest: './dist', // 設置
        輸出目錄 port: 2233, //端口 themeConfig: { //主題配置 // 添加導航欄 nav: [ { text: '主頁', link: '/' }, // 導航條 { text: '組件文檔', link: '/baseComponents/' }, { text: '知識庫', link: '/knowledge/' }, { text: 'github', // 這里是下拉列表展現形式。 items: [ { text: 'focus-outside', link: 'https://github.com/TaoXuSheng/focus-outside' }, { text: 'stylus-converter', link: 'https://github.com/TaoXuSheng/stylus-converter' }, ] } ], // 為以下路由添加側邊欄 sidebar:{ '/baseComponents/': [ { title: '布局類組件', collapsable: true, children: [ 'base/test1', 'base/test2', 'base/test3', 'base/test4', ] }, { title: '可視化組件', collapsable: true, children: [ ] }, { title: '工具類組件', collapsable: true, children: [ ] }, { title: '方法類函數', collapsable: true, children: [ ] } ], '/knowledge/': [ { title: 'CSS知識庫', collapsable: false, children: [ ] }, { title: 'JS知識庫', collapsable: false, children: [ ] }, { title: 'node知識庫', collapsable: false, children: [ ] }, { title: 'vue知識庫', collapsable: false, children: [ ] } ] } } }

        主題配置部分:在.vuepress/override.styl修改樣式:

        $accentColor = #3EB9C8 // 主題色
        $textColor = #2c3e50 // 文字顏色
        $borderColor = #eaecef // 邊框顏色
        $codeBgColor = #282c34 // 代碼背景顏色
        // 代碼庫重置
        .content pre{ margin: 0!important;}

        (3)增加其它擴展插件

        插件npm安裝:element-ui,vue-echarts,vue-highlight。

        在.vuepress/enhanceApp.js引入:

        /**
         * 擴展 VuePress 應用
         */
        import VueHighlightJS from 'vue-highlight.js';
        import 'highlight.js/styles/atom-one-dark.css';
        import Element from 'element-ui'
        import 'element-ui/lib/theme-chalk/index.css'
        import VueECharts from 'vue-echarts' //注冊圖表
        
        import './public/css/index.css' //組件css文件
        
        export default ({
         Vue, // VuePress 正在使用的 Vue 構造函數
         options, // 附加到根實例的一些選項
         router, // 當前應用的路由實例
         siteData // 站點元數據
        }) => {
         // ...做一些其他的應用級別的優化
         Vue.use(VueHighlightJS)
         Vue.use(Element)
         Vue.component('chart', VueECharts)
        }

        (4)Markdown 拓展

        調用別人寫好的輪子:https://www.npmjs.com/package/vue-highlight.js

         <highlight-code slot="codeText" lang="vue">
         <template>
         <div class="demo-button">
         <div>
         <dt-button>默認按鈕</dt-button>
         <dt-button type="primary">主要按鈕</dt-button>
         <dt-button type="success">成功按鈕</dt-button>
         <dt-button type="info">信息按鈕</dt-button>
         <dt-button type="warning">警告按鈕</dt-button>
         <dt-button type="danger">危險按鈕</dt-button>
         </div>
         </template>
         </highlight-code>

        (5)在Markdown 使用Vue-----插入按鈕樣式

        #先寫一個按鈕組件.\vuepress\docs\.vuepress\components\src\button.vue

        <template>
         <button
         class="dt-button"
         @click="handleClick"
         :disabled="disabled"
         :autofocus="autofocus"
         :type="nativeType"
         :class="[
         size ? 'dt-button--' + size : '',
         type ? 'dt-button--' + type : '',
         {
         'is-disabled': disabled,
         'is-round': round,
         'is-plain': plain
         }
         ]">
         <i :class="icon" v-if="icon"></i>
         <span v-if="$slots.default"><slot></slot></span>
         </button>
        </template>
        
        <script>
        export default {
         name: 'DtButton',
        
         props: {
         size: String,
         type: {
         type: String,
         default: 'default'
         },
         nativeType: {
         type: String,
         default: 'button'
         },
         disabled: Boolean,
         round: Boolean,
         plain: Boolean,
         autofocus: Boolean,
         icon: {
         type: String,
         default: ''
         }
         },
         methods: {
         handleClick (event) {
         this.$emit('click', event)
         }
         },
         mounted () {
         this.$emit('click', event)
         }
        }
        </script>

        #css樣式,在.\vuepress\docs\.vuepress\public\css\button.css,寫法參考餓了么。

        #在.\study\vuepress\docs\.vuepress\public\css\index.css匯總

        @import './iconfont.css';
        @import './icon.css';
        
        @import './card.css';
        @import './button.css'; //按鈕組件
        @import './checkbox.css';

        #在.\vuepress\docs\.vuepress\components\test\test1.vue文件夾下面調用button

        <template>
         <div class="demo-button">
         <div>
         <dt-button>默認按鈕</dt-button>
         <dt-button type="primary">主要按鈕</dt-button>
         <dt-button type="success">成功按鈕</dt-button>
         <dt-button type="info">信息按鈕</dt-button>
         <dt-button type="warning">警告按鈕</dt-button>
         <dt-button type="danger">危險按鈕</dt-button>
         </div>
         </div>
        </template>
        
        <script>
        import DtButton from '../src/button'
        export default {
         name: 'buttonWrap',
         components: {
         DtButton
         }
        }
        </script>
        
        <style lang="less" scoped>
        .demo-button{
         width: 100%;
         text-align: center;
         div {
         margin: 10px 0;
         }
        }
        </style>

        #vuepress會自動根據路徑注冊組件,我們只要映射文件路徑,就可以調用組件。

        在.\vuepress\docs\baseComponents\base\test1.md

        # 測試案例1
        ---
        <Common-Democode title="基本用法" description="基本按鈕用法">
         <test-test1></test-test1>
         <highlight-code slot="codeText" lang="vue">
         <template>
         <div class="demo-button">
         <div>
         <dt-button>默認按鈕</dt-button>
         <dt-button type="primary">主要按鈕</dt-button>
         <dt-button type="success">成功按鈕</dt-button>
         <dt-button type="info">信息按鈕</dt-button>
         <dt-button type="warning">警告按鈕</dt-button>
         <dt-button type="danger">危險按鈕</dt-button>
         </div>
         </div>
         </template>
         </highlight-code>
        </Common-Democode>
        
        | Tables | Are | Cool |
        | ------------- |:-------------:| -----:|
        | col 3 is | right-aligned | $1600 |
        | col 2 is | centered | $12 |
        | zebra stripes | are neat | $1 |

        #展示效果如圖:

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        如何使用VuePress搭建一個類型element ui文檔

        如何使用VuePress搭建一個類型element ui文檔:網站成果樣式 項目書寫步驟 github地址:https://github.com/xuhuihui/dataCom 官網:http://caibaojian.com/vuepress/guide/getting-started.html 參考文章:https://www.gxlcms.com/article/156259.htm 前言:
        推薦度:
        標簽: 文檔 類型 ui
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 7723日本高清完整版免费| 嫩草在线视频www免费看| 无码一区二区三区AV免费| 亚洲狠狠久久综合一区77777| 国产综合免费精品久久久| 久久亚洲高清综合| 三年片免费高清版 | 立即播放免费毛片一级| 德国女人一级毛片免费| 亚洲av无码偷拍在线观看| 日韩一区二区三区免费体验| 国产精品亚洲片在线花蝴蝶| 亚洲一级片内射网站在线观看| a高清免费毛片久久| 亚洲AV无码一区二区三区DV| 精品无码国产污污污免费网站| 亚洲第一永久在线观看| 女人张腿给男人桶视频免费版| 狠狠综合亚洲综合亚洲色| 亚洲av高清在线观看一区二区 | 在线观看www日本免费网站| 亚洲人成在线中文字幕| 看全色黄大色大片免费久久| 手机永久免费的AV在线电影网| 中文字幕精品亚洲无线码一区 | 国产免费久久久久久无码| 国产成人亚洲综合色影视| 四虎在线免费视频| 亚洲AV日韩综合一区| 国产亚洲av片在线观看播放| 亚洲免费视频网址| 黄色免费在线网址| 亚洲国产综合专区电影在线| 成人黄18免费视频| 国产精品美女久久久免费 | 免费羞羞视频网站| 久久不见久久见免费影院www日本| 久久久久亚洲精品日久生情 | 亚洲另类少妇17p| 最刺激黄a大片免费网站| 国产亚洲Av综合人人澡精品|