vux
  • 关于Vux
  • 开始使用之前
  • 常见问题
  • 兼容
  • 组件规范
  • PR规范
  • playground
  • 版本变更
  • 谁在使用
  • 最佳实践
  • 安装
    • vue-cli项目引用.vue组件(推荐)
    • vue-cli项目引用umd组件
    • 使用script全局引入
  • 布局组件
    • Flexbox
    • Scroller
    • Tab 选项卡
    • Popup 弹出层
    • Sticky 自动固定在顶部
    • Tabbar 底部导航
    • ButtonTab
    • Timeline
    • XHeader
    • Step
  • UI组件
    • divider 横向分隔线
    • badge
    • icon
    • Search 搜索
  • 常用样式
    • 1px解决方案
    • reddot红点提示
  • 表单组件
    • Group表单分组组件
    • Cell
    • Address
    • x-button 按钮
    • x-input 单行文本输入
    • x-textarea 多行输入框
    • x-number 数字输入
    • checklist 多选
    • selector 下拉选择
    • switch 开关
    • rater 评分
    • Inline-Calendar 内联日历
    • Calendar 日历
    • Radio 单选
    • Checker 灵活的选择组件
    • Datetime 时间
    • Range
    • picker
    • popup-picker
    • 表单验证(v0.1.1)
  • 时间组件
    • 日期倒计时
    • 秒数倒计时
    • 轻量时间格式化
    • 相对时间
  • 数字组件
    • number-roller 数字滚动
  • 提示组件
    • Loading
    • Alert
    • Confirm
    • Toast
    • Actionsheet
    • Dialog
    • Spinner
  • 图片
    • 背景模糊
    • 半透明遮罩
    • 轮播
    • 表情图片
    • 上传(未支持)
    • 点击全屏预览图片(未支持)
  • 动态检测
    • 屏幕翻转
    • 手机摇一摇
  • 图表组件
    • Circle 圆圈
  • http请求
  • router 路由
  • 手势操作
Powered by GitBook
On this page
  • 页面接口
  • https://vux.li/api/v1/demo.html
  • url参数
  • 在文档中的例子:
  • 渲染结果

playground

PreviousPR规范Next版本变更

Last updated 7 years ago

页面接口

简易接口,用于把代码拼凑成完整的vue页面,文档中的例子都是使用该接口以iframe嵌入。

注意GET方式url长度有限制,所以这种方式用于相对简单的例子。

url参数

  • components 使用的组件,英文逗号分隔,如 Group,Radio

  • javascript js代码,以export default {开头, }结束

  • template 模板,普通html代码

  • style 样式,只支持一般css,不支持指定lang及scoped

在文档中的例子:

写法同vue文件,但是只支持普通css写法,不支持less等。不支持import外部组件。

通过components来注册使用到的组件,必需

宽度width默认为100%

高度height默认为 100

``` vux width=100% height=100 components=Circle raw=true
<template>
  <div style='width:100px;height:100px;'>
    <circle :percent='percent2' :stroke-width=6 :trail-width=6 :stroke-color='strokeColor2' trail-color="#ececec">
      <span :style="{color: strokeColor2}">{{percent2}}%</span>
    </circle>
  </div>
</template>

<script>
export default {
  ready () {
    setInterval(this.update, 2000)
  },
  data () {
    return {
      percent2: 30,
      strokeColor2: '#3FC7FA'
    }
  },
  methods: {
    update: function () {
      const colorMap = ['#3FC7FA', '#85D262', '#FE8C6A']
      this.percent2 = parseInt(Math.random() * 100, 10)
      this.strokeColor2 = colorMap[parseInt(Math.random() * 3, 10)]
    }
  }
}
</script>

<style>
.hello {


}
</style>
```

渲染结果

``` vux width=100% height=100 components=Circle

{{percent2}}%

export default { ready () { setInterval(this.update, 2000) }, data () { return { percent2: 30, strokeColor2: '#3FC7FA' } }, methods: { update: function () { const colorMap = ['#3FC7FA', '#85D262', '#FE8C6A'] this.percent2 = parseInt(Math.random() * 100, 10) this.strokeColor2 = colorMap[parseInt(Math.random() * 3, 10)] } } }

.hello { } ```

https://vux.li/api/v1/demo.html