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

best-city

v1.0.1

Published

A Vue.js project,the purpose is to make the city more convenient

Downloads

2

Readme

best-city

npm downloads

best-city 是什么

best-city 是一款用于解决移动端选择城市需求的插件。在兼顾体验度如丝般顺滑的同时,做到了市面上大多数插件不曾拥有的交互体验,力求做到如真实的ntive般的体验。

不仅在移动网页端,best-city 在还是雏形阶段时已经被应用到了H5+混合移动app应用中,并成为应用的一大亮点。

在best-city的右边是一条Nav,不仅仅可以点击,还能如丝般顺滑的滑动,手指划过Nav,与城市列表交互的感觉是别的插件无法带给你的。

Attributes

在1.0.1发布的best-city中,用户可以根据设置属性来定制属于自己的移动端城市选择组件。

| 参数 | 说明 | 类型 | 可选值| 默认值| |:---|:---|:---|:---|:---| | slide | 插件页面过渡动画 | String | vertical/horizontal | vertical | | canSearchSpell | 是否支持拼音搜索 | Boolean | true/false | true | | location | 当前定位 | Object | —— | 北京 | | backStyle | 返回键的样式 | String | cross/retreat/tilted/fold/return | retreat |

Events

在1.0.1发布的best-city中,用户可以根据事件在获得插件的返回值。

| 事件名称 | 说明 | 回调参数 | |:---|:---|:---| | closeChooseCity | 关闭城市选择插件的事件 | 选中的 city 对象 / null |

Methods

在1.0.1发布的best-city中,用户可以调用插件的方法达到自己的目的。

| 方法名称 | 说明 | 回调参数 | |:---|:---|:---| | show | 打开城市选择插件 | —— | | hide | 关闭城市选择插件 | —— |

用法

best-city用法简单,首先下载依赖:

npm install best-city -S

然后添加到你的项目中, 将下列代码加在 main.js中:

import BestCity from 'best-city'

Vue.use(BestCity)

Model

<template>
  <div id="app">
    <button @click="showCity">点击</button>
    <best-city
      ref="vuecity"
      @closeChooseCity="getCity"
    ></best-city>
  </div>
</template>
export default {
  name: 'app',
  methods: {
    getCity(val) {
      console.log(val);
    },
    showCity() {
      this.$refs.vuecity.show();
    }
  }
};

Screenshot

代码注释思路以master分支的文档为例,代码的优雅准确以npm0.1分支为例。