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

vi-address

v0.0.1

Published

微信小程序地址三级联动组件

Downloads

2

Readme

微信小程序省市区三级联动组件

使用

npm i vi-address 使用微信开发者工具构建NPM并勾选使用NPM模块

打开小程序页面的json配置.

"usingComponents": {
  "vi-address": "/vi-address"
}

WXML结构

<view class="font14" bindtap='selectAddress'>点击选择城市: {{address}}</view>

<vi-address is-hide="{{isHide}}" bindhide="selectAddress" bindaddresschange="addressChange"></vi-address>

js逻辑

Page({
  data: {
    address: '',
    isHide: false
  },
  selectAddress(e) {
    this.setData({
      isHide: !this.data.isHide
    })
  },
  addressChange({ detail }) {
    this.setData({
      address: detail.detail.map(item => item.name).join('-')
    })
  }
})

属性 Props

| 接口 | 数据类型 | 说明 | 选项 | 默认值 | | :--: | :--: | :--: | :--: | :--: | | isHide | Boolean | 控制组件的显示与隐藏, false 隐藏, true 显示 | 必填 | false | | areaHide | Boolean | 是否显示区/县, false 显示, true 隐藏 | 选填 | false |

事件 Events

| 事件方法 | 事件说明 | detail 返回值 | | :--: | :--: | :--: | | cancel | 组件的取消按钮或者是点击的遮罩层 | 无返回值 | | confirm | 组件的确认按钮 | 返回选择的城市 | | hide | 组件隐藏, cancel 与 confirm 都会触发该事件 | 返回值为触发的事件源, 如:取消按钮触发的事件, 则返回值为 cancel | | addresschange | 省市区选择事件 | 只要有选择便会触发该事件, 组件初始化时会默认触发一次, 返回值为数组集合 |

Bug&Tips

  • 地址三级联动组件,显示与隐藏有默认动画,所以不需要给组件父级元素套一个处理动画的Propu组件
  • 该组件使用的选择器为微信小程序的 picker-view 内置组件, 所以对用户体验可能会存在一定影响
  • 由于是使用picker-view 内置组件,所以该组件暂无设置初始默认值的接口。目前正在尝试其他解决方式