Giter VIP home page Giter VIP logo

vuepress-demo's Introduction

Vuepress Demo

基于 vuepress-plugin-demoblock-plus 插件来实现vue组件的支持。

  • vue组件
<demo-block>
  <xl-button>默认按钮</xl-button>
  <xl-button type="primary">主要按钮</xl-button>
  <xl-button type="success">成功按钮</xl-button>
  <xl-button type="info">信息按钮</xl-button>
  <xl-button type="warning">警告按钮</xl-button>
  <xl-button type="danger">危险按钮</xl-button>
</demo-block>

image-20210615194021326

  • vue代码自动渲染并且显示对应code(支持script和style)

:::demo 使用typeplainroundcircle属性来定义 Button 的样式。

<template>
  <xl-button>默认按钮</xl-button>
  <xl-button type="primary">主要按钮</xl-button>
  <xl-button type="success">成功按钮</xl-button>
  <xl-button type="info">信息按钮</xl-button>
  <xl-button type="warning">警告按钮</xl-button>
  <xl-button type="danger">危险按钮</xl-button>
</template>

:::

image-20210624155537957

  • 支持script和style

:::demo 使用typeplainroundcircle属性来定义 Button 的样式。

<template>
  <input class="input" type="text" v-model="input"/>
  <xl-button type="primary" @click="onSubmit">提交</xl-button>
  <div style="margin-top: 16px">输出内容:{{ content }}</div>
</template>

<script>
import { ref, defineComponent } from 'vue'

export default defineComponent({
  name: 'InputDemo',
  setup() {
    const input = ref()
    const content = ref()

    function onSubmit() {
      content.value = input.value
    }

    return { input, content, onSubmit }
  }
})
</script>

<style>
.input {
  border: 1px solid #ebebeb;
  border-radius: 4px;
  padding: 14px;
  width: 300px;
  font-size: 16px;
  margin-right: 16px;
}
</style>

:::

image-20210624155804884

vuepress-demo's People

Contributors

xinlei3166 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vuepress-demo's Issues

此demo克隆并使用pnpm安装依赖后运行vuepress报错

本Demo克隆到本地后,使用pnpm安装了依赖,然后运行yarn docs:dev命令报错如下:

$ yarn docs:dev
yarn run v1.22.19
$ vuepress dev docs
X [ERROR] Could not resolve "../../dist/node/index.mjs"

    docs/.vuepress/config.js:2:32:
      2 │ import { demoblockPlugin } from '../../dist/node/index.mjs'~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: Build failed with 1 error:
docs/.vuepress/config.js:2:32: ERROR: Could not resolve "../../dist/node/index.mjs"
    at failureErrorWithLog (E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:1566:15)
    at E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:1024:28
    at runOnEndCallbacks (E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:1438:61)
    at buildResponseToResult (E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:1022:7)
    at E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:1134:14
    at responseCallbacks.<computed> (E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:671:9)
    at handleIncomingPacket (E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:726:9)
    at Socket.readFromStdout (E:\BarryFlynn\vuepress-plugin-demoblock-plus\node_modules\.pnpm\e[email protected]\node_modules\esbuild\lib\main.js:647:7)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

此外,那个vuepress-plugin-demoblock-plus插件在我另一个项目里貌似也无法正常使用,即使我将VuePress 版本降为[email protected],只要安装那个插件控制台就报错Uncaught ReferenceError: Cannot access 'clientConfigs' before initialization,卸载就恢复正常

不是很明白依赖中cross-env和@vue/compiler-sfc的作用

关于cross-env依赖

我只知道使用cross-env后,确实可以在配置文件中用process.env.BASE作为的base配置项的值。但如果只是为了方便在scripts中方便改BASE值的话,感觉有点多余,在配置文件中也一样能改。

关于@vue/compiler-sfc依赖

我是真没找到这个依赖是哪个插件或者哪个功能需要使用到了,可以说一下吗

安装后,运行报错

demo安装完依赖,运行报错。提示:
const lang = options?.lang || 'vue'
^

SyntaxError: Unexpected token '.'
不识别可选链

插件安装到vuepress2项目也是一样。

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.