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

vue-run-online

v1.0.6

Published

基于vue-fun-sfc 进行修改,扩展增加字段

Downloads

31

Readme

vue-run-online

vue-run-online 是一款能够在线编辑/预览代码效果的vue组件

前置说明

vue-run-online 是基于vue-fun-sfc组件进行自定义改造,在原来基础上增加了一些属性和可自定义配置项目,主要是为了配置自己自定义组件库而进行改造,非商业用途~

使用说明

安装

npm install vue-run-online

使用

  • 全局使用
import VueRunOnline from "vue-run-online";
 
Vue.use(VueRunOnline, { 
  cssLabs: ["https://unpkg.com/[email protected]/normalize.css"],
  jsLabs: ["https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js"], 
});
  • 局部使用
<script>
  import { VueRunOnline } from "vue-run-online";
 
  export default {
    components: { VueRunOnline }
  };
</script> 

传入说明

props

属性 | 类型 |默认值|属性描述|可选值 ---|---|---|---|--- code | string | '' | 传入的需要进行demo演示的代码 jsLabs | Array|String | ' ' | code执行所需要js资源 cssLabs | Array|String | ' ' | code执行所需要css canEdit| Boolean | true |是否可以编辑代码区域 comDesc|String |''|组件说明 展示在头部下面 hideAllBtn|Boolean| false| 隐藏头部所有按钮 hideButtons|Array|[]|隐藏头部三个按钮组|['reset','full','layout'] hideRight|Boolean |false |隐藏右下角内容配置 rightLink|String|' '|右下角链接配置 rightText|String|' '|右下角链接文字配置 vueUrl|string|''|引入的Vue的版本,解决版本不同的问题 默认是https://cdn.jsdelivr.net/npm/[email protected] js | Array|String | ' ' | code执行所需要css css | Array|String | ' ' | code执行所需要css themeColor | String | '#409eff' | 代码演示主题效果颜色 themeBorderColor | String |'#eaeefb' | 代码演示主题边框色 row | Boolean |false | 代码和演示效果的排列效果 true 左右排列 false上下排列 | reverse | Boolean | false | 代码和演示效果上下排列时候 代码区和编辑区上下位置 false 编辑器在下, 展示区在上 true 编辑器在上, 展示区在 下 | title | String | '' | 代码展示标题名称 | height | String | '' | 代码展示高度 | open | Boolean | true | 是否自动打开编辑区域 | isHideHeader | Boolean | false | 是否隐藏头部 |

slots

提供了三个可以插槽功能

插槽名称 |描述 ---|--- header | 头部插槽位置 页面头部中间部分 当hideAllBtn==true时,将会展示在右侧 desc | 组件说明部分 和comDesc字段渲染在一个位置 footer | 底部右下角说明部分 和其他的配置项目一起展示

demo示例

基本正常使用 可编辑状态

  <vue-run-online
          :js-labs="jsLabs"
        :css-labs="cssLabs"
        title="测试DEMO"
        :open="true"
        :code="code"
      >
      <div slot='header'>我是标题呀</div>
      <div slot="footer">我是底部的标签呀</div> 
      </vue-run-online>
<script>
 data() {
    return {
      exampleCode: exampleCode,
      codemirrorOption: codemirrorOption,
      jsLabs: ["https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js"],
      cssLabs: [
        "https://cdn.jsdelivr.net/npm/[email protected]/lib/theme-chalk/index.css"
      ],
      code: `<template>
  <div>
    <h1>{{title}}</h1>
    <div><el-button type="primary" @click="handleClick">可以进行操作</el-button></div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        title: "我是按钮"
      };
    },
    methods: {
      handleClick () {
        this.$message.success('')
      }
    }
  };
<\/script>

<style lang="scss">
  body {
    #box {
      color: #409EFF;
    }
  }
</style>`
    };
  }
</script>

image

预览demo

 <vue-run-online
        :hideButtons="['reset']"
        :js-labs="jsLabs"
        :css-labs="cssLabs"
        :open="true"
        :canEdit="false"
        :code="code3"
      >
        <div slot="header">我是标题呀</div>
        <div slot="desc">我是组件说明嘻嘻</div>
        <div slot="footer">我是底部的标签呀</div>
      </vue-run-online>
    //code
       code3: `<template>
  <div>
   我是一个静态的可预览的文件呀
  </div>
</template>`,

image

参考地址