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

@wines/rater

v1.5.1

Published

The rater @wines

Downloads

23

Readme

@wines/rater

Rater 评分组件

对评价进行展示或对事物进行快速的评级操作。

使用指南

在 page.json 中引入组件

{
  "navigationBarTitleText": "Rater",
  "usingComponents": {
    "wux-cell": "@wines/cell",
    "wux-cell-group": "@wines/cell-group",
    "wux-rater": "@wines/rater"
  }
}

示例

<view class="page">
	<view class="page__hd">
		<view class="page__title">Rater</view>
		<view class="page__desc">评分组件</view>
	</view>
	<view class="page__bd">
		<wux-cell-group title="Normal Usage">
			<wux-cell title="Set default score = 5" hover-class="none">
				<wux-rater slot="footer" default-value="{{ 5 }}" />
			</wux-cell>
			<wux-cell title="Change color" hover-class="none">
				<wux-rater slot="footer" default-value="{{ 3 }}" active-color="#33cd5f" />
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="AllowHalf & AllowClear">
			<wux-cell title="AllowHalf = true" hover-class="none">
				<wux-rater slot="footer" allow-half default-value="{{ 2.5 }}" />
			</wux-cell>
			<wux-cell title="AllowClear = true" hover-class="none">
				<wux-rater
				 slot="footer"
				 allow-half
				 allow-clear
				 default-value="{{ 2.5 }}"
				/>
			</wux-cell>
			<wux-cell title="AllowTouchMove = true" hover-class="none">
				<wux-rater
				 slot="footer"
				 allow-half
				 allow-clear
				 allow-touch-move
				 default-value="{{ 2.5 }}"
				/>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Disabled = true">
			<wux-cell title="Your history score" hover-class="none">
				<wux-rater slot="footer" default-value="{{ 3 }}" disabled />
			</wux-cell>
			<wux-cell title="Decimal score 3.7" hover-class="none">
				<wux-rater slot="footer" default-value="{{ 3.7 }}" disabled />
			</wux-cell>
			<wux-cell title="Custom font-size(15px)" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 font-size="{{ 15 }}"
				 disabled
				/>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Custom star">
			<wux-cell title="Loving" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 margin="{{ 15 }}"
				 star="♡"
				/>
			</wux-cell>
			<wux-cell title="Sunshine" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 margin="{{ 15 }}"
				 star="☼"
				/>
			</wux-cell>
			<wux-cell title="Smilies" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 margin="{{ 15 }}"
				 star="☻"
				/>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Custom Icon">
			<wux-cell title="Loving" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 margin="{{ 15 }}"
				 icon="ios-heart"
				/>
			</wux-cell>
			<wux-cell title="Sunshine" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 margin="{{ 15 }}"
				 icon="ios-sunny"
				/>
			</wux-cell>
			<wux-cell title="Smilies" hover-class="none">
				<wux-rater
				 slot="footer"
				 default-value="{{ 3 }}"
				 margin="{{ 15 }}"
				 icon="ios-happy"
				/>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Custom text">
			<wux-cell title="Star" hover-class="none">
				<view slot="footer">
					<wux-rater controlled value="{{ value }}" bind:change="onChange" />
					<text class="wux-rater__text">{{ value }} stars</text>
				</view>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Set callback">
			<wux-cell title="How embarrass" hover-class="none">
				<wux-rater
				 slot="footer"
				 controlled
				 value="{{ value }}"
				 star="囧"
				 bind:change="onChange"
				/>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Controlled">
			<wux-cell title="Very good" hover-class="none">
				<wux-rater
				 slot="footer"
				 controlled
				 value="{{ slider }}"
				 star="屌"
				 bind:change="sliderChange"
				/>
			</wux-cell>
			<wux-cell hover-class="none">
				<slider
				 value="{{ slider }}"
				 show-value
				 min="0"
				 max="5"
				 bindchange="sliderChange"
				/>
			</wux-cell>
		</wux-cell-group>
		<wux-cell-group title="Set callback">
			<block wx:for="{{ items }}" wx:key="index">
				<wux-cell title="{{ item.text }}" hover-class="none">
					<wux-rater slot="footer" default-value="{{ item.value }}" />
				</wux-cell>
			</block>
		</wux-cell-group>
	</view>
</view>
import './index.less';

Page({
  data: {
    items: [
      {
        id: '001',
        text: 'Face',
        value: 1,
      },
      {
        id: '002',
        text: 'Eye',
        value: 2,
      },
    ],
    slider: 0,
    value: 3,
  },
  sliderChange(e) {
    this.setData({
      slider: e.detail.value,
    });
  },
  onChange(e) {
    this.setData({
      value: e.detail.value,
    });
    console.log(e);
  },
});

API

Rater props

| 参数 | 类型 | 描述 | 默认值 | | --- | --- | --- | --- | | prefixCls | string | 自定义类名前缀 | wux-rater | | max | number | 最大值 | 5 | | icon | string | 图标名称,优先级高于 star | - | | star | string | 图标 | ★ | | defaultValue | number | 默认值,当 controlledfalse 时才生效 | 0 | | value | number | 当前数,当 controlledtrue 时才生效 | 0 | | activeColor | string | 图标激活的颜色 | #ffc900 | | margin | number | 图标外边距 | 2 | | fontSize | number | 图标大小 | 25 | | disabled | boolean | 禁用点击 | false | | allowHalf | boolean | 是否允许半选 | false | | allowClear | boolean | 是否允许再次点击后清除 | false | | allowTouchMove | boolean | 是否允许触摸移动选中 | false | | controlled | boolean | 是否受控 说明文档 | false | | bind:change | function | 点击事件的回调函数 | - |

Rater externalClasses

| 名称 | 描述 | | --- | --- | | wux-class | 根节点样式类 |