npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vuepress-plugin-vue-compdemo

v1.0.0

Published

一个能生成和element-ui官网一样的组件演示效果的插件

Downloads

2

Readme

简介

一个能生成和 element-ui 官网一样的组件演示效果的 vuepress 插件

效果

起步

  • 安装
npm i -D vuepress-plugin-compdoc

支持的版本

  • 暂只支持:vuepress v1.xv2.x版本

使用插件

  • 在 vuepress 中引入插件
// .vuepress/config.js
module.exports = {
  plugins: [[require('vuepress-plugin-vue-compdemo')]]
}
  • 识别的容器
:::demo 这里是描述
// ```vue 
// 一些vue组件单文件的内容 
//```
:::
  • 例如:
:::demo 在 Alert 组件中,你可以设置是否可关闭,关闭按钮的文本以及关闭时的回调函数。`closable`属性决定是否可关闭,接受`boolean`,默认为`true`。你可以设置`close-text`属性来代替右侧的关闭图标,注意:`close-text`必须为文本。设置`close`事件来设置关闭时的回调。
```vue
<template>
  <div>
    <el-alert
      title="不可关闭的 alert"
      type="success"
      :closable="false">
    </el-alert>
    <el-alert
      title="自定义 close-text"
      type="info"
      close-text="知道了">
    </el-alert>
    <el-alert
      title="设置了回调的 alert"
      type="warning"
      @close="hello">
    </el-alert>
  </div>
</template>

<script>
  export default {
    methods: {
      hello() {
        alert('Hello World!');
      }
    }
  }
</script>
```
:::
  • 编译后显示的效果:

效果

插件配置

  • compItemListarray): 需要用到的演示组件或依赖组件的导入配置项
    • isInstallboolean): 默认:false,是否该组的模块是以安装 vue 插件的形式导入,app.use(...),否则 app.component(...),取决于你导入的模块
    • isRequireboolean): 默认:false, 是否该组的模块是使用 require 导入,否则 import
    • pathListarray): vue 组件单文件路径或 node_modules 的模块的名称
  • stylePathListarray): css样式导入,相当于 import 'element-plus/dist/index.css',其他格式的样式导入的话取决于你是否装了对应的loader
  • demoBlockNamestring:) 默认:'demo',识别 mrakdown 容器的名称 ::: ${demoBlockName}
  • vuepressVersion:默认:2,vuepress的版本号,如果是v1.x,就填 1 即可
// .vuepress/config.js
module.exports = {
  plugins: [
    [
      // 导入插件
      require('vuepress-plugin-vue-compdemo'),
      {
        compItemList: [
          {
            // 是否是已安装vue插件的形式,app.use(...),否则app.component(...)
            isInstall: true,
            // 是否是使用require导入,否则import
            isRequire: true,
            // vue组件文件路径或node_modules的模块的名称
            pathList: ['element-plus']
          }
        ],
        // 样式导入,相当于 import 'element-plus/dist/index.css'
        stylePathList: ['element-plus/dist/index.css'],
        // 识别mrakdown容器的名称 ::: ${demoBlockName}
        demoBlockName: 'demo',
        // vuepress的版本号
        vuepressVersion: 2
      }
    ]
  ]
}

常见问题