Giter VIP home page Giter VIP logo

docsify-demo-box-vue's Introduction

docsify-demo-box-vue

write Vue demo in docsify with instant preview and jsfiddle integration

Your sample code can be rendered on the page instantly, so the people who read your document can see the preview immediately. If he/she expands the demo box, the source code and description are shown there. Click the button Try in Jsfiddle, jsfiddle.net will be open with the code of this sample.

Doc

This plugin is for Vue. For React, please use docsify-demo-box-react

Showcase

These projects are using docsify-demo-box-vue. Pull requests welcome 😊

Project Description
vue-data-tables A simple and customizable data table,based on vue2 and element-ui.

docsify-demo-box-vue's People

Contributors

njleonzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docsify-demo-box-vue's Issues

Add config to choose http or https jsfiddle?

This project is very helpful. However, i found that this project is using an https jsfiddle api, which means i have to move all my js/css resources served into an https server, which is hard when my components is still developing or even not published. So, is it possible to add a config to choose http or https jsfiddle api?

vue react 无法同时使用?

自己搭建的文档上会同时存在 vue 和 react 组件(不同的 md 文件),单独配置任何一个都没问题,但是同时启用就不行,放前边的 vue 不生效,后边的 react 能渲染出来,但无法查看源码。代码均使用的文档中的示例代码。

  DemoBoxVue.create(jsResources, cssResources, bootCode),
  DemoBoxReact.create(jsResources, cssResources, bootCode)

在docify中使用该插件,运行时报错,提示Babel is not defined

在docify中使用该插件,运行时报错,提示Babel is not defined。

配置如下:

 <script src="//unpkg.com/vue/dist/vue.js"></script>
  <script src="https://unpkg.com/docsify-demo-box-vue/dist/docsify-demo-box-vue.min.js"></script>
  <script>
var jsResources = '<scr' + 'ipt src="//unpkg.com/vue/dist/vue.js"></scr' + 'ipt>';
var cssResources = '@import url("//cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css");';
var bootCode = 'var globalVariable = "leon"';
var globalVariable = "leon" ;
window.$docsify = {
    name: '',
    repo: 'https://github.com/njleonzhang/docsify-demo-box-vue',
    plugins: [
        DemoBoxVue.create(jsResources, cssResources, bootCode)
    ],
    el: '#main',
    executeScript: true
}
  </script>
  <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

The plugin caused the markdown setting to fail.

  • node: v8.9.4
  • docsify-cli: 4.2.1

由于 docsify-demo-box-vue 插件导致 markdown 的配置失效

  1. 正常运行的配置 markdown: { breaks: true, },
  2. 添加插件文件 docsify-demo-box-vue.js
  3. 初始化插件 plugins: [ DemoBoxVue.create(jsResources, cssResources, bootCode) ]
  4. 导致 markdown: { breaks: true, }, 失效

Markdown configuration disabled due to docsify-demo-box-vue plugin

  1. Normal operation configuration markdown: { breaks: true, },
  2. Add plugin file docsify-demo-box-vue.js
  3. Initialization plugin plugins: [ DemoBoxVue.create(jsResources, cssResources, bootCode) ]
  4. Lead to failure markdown: { breaks: true, },

image

本地运行顺利,部署到服务器Vue就报错

错误信息如下

[Vue warn]: Error compiling template:

<article class="markdown-section" id="main"><p>&lt;!DOCTYPE html&gt;</p>

  <meta charset="UTF-8">
  <title>vk-mobile-ui 官方文档</title>
  <meta name="description" content="Description">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <!-- vkmui组件样式 -->
  <link rel="stylesheet" href="./dist/vkmui.css">
  <!-- 文档自定义样式 -->
  <link rel="stylesheet" href="./style/thame.css">
  <link rel="stylesheet" href="./style/thame-reset.css">


  <div id="app"></div>

<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="./js/babel.min.js"></script>
<!-- vkmui组件js -->
<script src="./dist/vkmui.js"></script>
<script src="./dist/flexible.js"></script>
<script src="./js/docsify-demo-box-vue.min.js"></script>
<script src="./js/init.js"></script>
<script src="./js/docsify.min.js"></script>
<script src="./js/external-script.min.js"></script>
</article>

- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
(found in <Root>)

请问这个可能是什么原因呢

Uncaught SyntaxError: Unexpected token export

How solve this error?

image

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="description" content="Description">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
  <div id="app"></div>
  <script src="//unpkg.com/vue/dist/vue.min.js"></script>
  <script src="//unpkg.com/docsify-demo-box-vue/dist/docsify-demo-box-vue.min.js"></script>
  <script>
    var jsResources = '<scr' + 'ipt src="//unpkg.com/vue/dist/vue.js"></scr' + 'ipt>'
    var cssResources = '@import url("//cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css");'
    var bootCode = 'var globalVariable = "leon"'
    var globalVariable = "leon"

    window.$docsify = {
      name: '',
      repo: '',
      plugins: [
        DemoBoxVue.create(jsResources, cssResources, bootCode)
      ]
    }
  </script>
  <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
</html>

md:

/*vue*/
<template>
  <div>
    <div class='wrapper'>
      <div>
        <p>author: {{globalVariable}}</p>
        <button :style="style" @click="onClick">test</button>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        globalVariable,
        style: {
          color: 'blue'
        }
      }
    },
    methods: {
      onClick() {
        alert('author: ' + this.globalVariable)
        this.style.color = 'red'
      }
    }
  }
</script>

Style 能否支持 processor?

目前看在 vue 中写普通 css 没问题,但还不支持解析 scss 之类的(或者有某些配置方式?),不清楚作者有这个计划么?

比如:

/*vue*/
<template>
  <div class="box">
    <div class="sub1">should be red</div>
    <div class="sub2">should be blue</div>
  </div>
</template>
<script>
export default {}
</script>
<style lang="scss">
.box {
  .sub1 {
    color: red;
  }
}
.box .sub2 {
  color: blue;
}
</style>

sub1 的颜色并不会生效,看编译后的代码 scss 并没有转换。

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.