@vuepress-dumi/vuepress-plugin-dumi-previewer
v0.3.11
Published
A dumi style code previewer plugin for VuePress.
Downloads
302
Maintainers
Readme
English | 简体中文
💡attention: whitespace is in need before demo
::: demo
<div @click="handleClick">click me</div>
<script>
export default {
methods: {
handleClick() {
console.warn('clicked')
}
}
}
</script>
:::
If you need code scope, you can use demo[scope]
.
💡attention: <template></template>
is in need, and you can not use import
statment in scope mode. And if you use demo[scope]
and demo
in one markdown file, browser may print some error.
::: demo[scope]
<template>
<div>{{ foo }}</div>
</template>
<script>
export default {
data() {
return { foo: 'foo' }
}
}
</script>
:::
::: demo[scope]
<template>
<div>{{ foo }}</div>
</template>
<script>
export default {
data() {
return { foo: 'bar' }
}
}
</script>
:::
Install
First of all, install vuepress v1.x
Then install the plugin
$ npm i -D @vuepress-dumi/vuepress-plugin-dumi-previewer
# OR
$ yarn add -D @vuepress-dumi/vuepress-plugin-dumi-previewer
Usage
Write vuepress config
// .vuepress/config.js
module.exports = {
plugins: ['@vuepress-dumi/dumi-previewer'],
}
Preview
💡attention: if you want to import element-ui like me, you need install [email protected]
$ npm i -D [email protected]
# OR
$ yarn add -D [email protected]
Thanks
This repo is inspired by the following projects, Thanks for their great work.