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

@luban-h5/plugin-common-props

v0.2.8

Published

鲁班H5插件的常见属性

Downloads

10

Readme

鲁班H5 组件通用属性

  • 可以简单理解为类似 React 的 PropsType
  • 为了方便组件开发者在开发自定义组件的时候,快速引用

以开发一个按钮组件为例

需要在右边属性编辑面板(如下图)配置按钮的如下属性:

image

  • 显示文字(字符串类型: PropTypes.string, 对应一个文本输入框)
  • 字体大小(数值类型: PropTypes.number, 对应一个数字输入框)
  • 边框宽度(数值类型: PropTypes.number, 对应一个数字输入框)
  • 文字颜色(颜色类型: PropTypes.color, 对应一个颜色选择器)
  • 背景色(颜色类型: PropTypes.color, 对应一个颜色选择器)
  • 文字对齐(颜色类型: PropTypes.textAlign, 对应对齐选择器)

我们在开发按钮组件的时候,只要配置其 props 参照如下即可

export default {
  name: 'luban-h5-button',
  props: {
    text: PropTypes.string(),
    backgroundColor: PropTypes.color({
      label: '背景色',
      defaultValue: 'rgba(255, 255, 255, 0.2)'
    }),
    color: PropTypes.color(),
    fontSize: PropTypes.number({ label: '字号(px)' }),
    borderWidth: PropTypes.number({
      label: '边框宽度(px)',
      defaultValue: 1
    }),
    borderRadius: PropTypes.number({
      label: '圆角(px)',
      defaultValue: 4
    }),
    borderColor: PropTypes.color({
      label: '边框颜色',
      defaultValue: '#ced4da'
    }),
    textAlign: PropTypes.textAlign()
  }
}

通用配置

| 类型 | PropTypes[type] | 默认值.label | 默认值.defaultValue 值 | 默认值.defaultValue 类型 | 默认值.props | 默 认值.props 解释 | |-------------- |----------------- |---------------------- |--------------------------------------------------- |-------------------------- |-------------------------------------- |----------------------------------------------------- | | 字符 | string | '文字内容' | '文字内容' | String | - | | | 数值 | number | '数值' | 10 | Number | { step: 1, min: 0, max: 144 } | 用于配置数值编辑器的属性,比如 最小值、最大值、步长 | | Boolean | boolean | '开关' | false | Boolean | - | | | 颜色 | color | '文字颜色' | '#000000' | String | - | | | 文字对齐 | textAlign | '文字对齐' | '文字对齐' | String | - | | | 简单选项列表 | textOptions | '选项列表' | [ { label: 'label1', value: 'value1' } ] | Array | - | | | 图片选择器 | image | '图片' | '' | String | - | |

安装

yarn add @luban-h5/plugin-common-props