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

@south-rd/smarthub-areas-vant

v1.0.3

Published

省市区联动VUE-vant插件

Downloads

2

Readme

smart-file

本地项目初始化

yarn install

查看例子

yarn dev

组件打包

yarn run lib

基于 elementui,使用响应式处理元素 PC、手机样式

本地开发调试

本地项目 执行组件打包命令

yarn run lib

开启文件链接

yarn link

本地项目环境安装本组件

项目链接引用

yarn link @south-rd/smarthub-areas-vant

引入组件

import smarthubareasVant from '@south-rd/smarthub-areas-vant'
import '@south-rd/smarthub-areas-vant/lib/smarthub-areas-vant.css'
Vue.use(smarthubareasVant)

使用组件

组件名称

<smarthubareasVant @kidChange="checkEditBills"></smarthubareasVant>

子组件参数

<template>
  <div class="smarthub-areas-vant">
    <div class="label-content">
      <Field
        input-align="right"
        readonly
        clickable
        value
        placeholder="点击选择省市区"
        @click="showArea = true"
        label-width="60"
      >
        <span slot="label" > 省市区 </span>
        <template v-if="form.area.length > 0" slot="input">
          <div class="citydiv" v-for="v in cityvalue" :key="v.code">{{ v.name }}</div>
        </template>
      </Field>
      <Popup v-model="showArea" position="bottom">
        <Area
          :columns-num="3"
          :area-list="areaList"
          @confirm="oncityConfirm"
          @cancel="showArea = false"
        />
      </Popup>
    </div>
  </div>
</template>
<script>
import { Field,Popup,Area } from 'vant';
// @ is an alias to /src
import areaList from "../../examples/area";
import cityArr from "../../examples/cityArr";
export default {
  name: "smarthubareasVant", // 注意这个name是必须的,定义对外组件的名称
   components: {
    Field,Popup,Area
  },
  data() {
    return {
      cityvalue: [],
      showArea: false,
      form: {
        area: [],
      },
      areaList,
    };
  },
  created() {
  },
  methods: {
    showDetail() {
      this.showFlag = true;
    },
    oncityConfirm(values) {
      // console.log(values, 1998);
      this.cityvalue = values;
      this.form.area = [];
      this.cityvalue.map((v, k) => {
        if (k == 0) {
          return this.form.area.push(
            cityArr.province.filter((e) => {
              return e[1] == v.name;
            })[0][0]
          );
        } else if (k == 1) {
          return this.form.area.push(
            cityArr.city.filter((e) => {
              return e[1] == v.name;
            })[0][0]
          );
        }
      });
      this.showArea = false;
       this.$emit("kidChange", {values:values});
    },
  },
};
</script>
<style lang="less">
body,
html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
.smarthub-areas-vant {
  width: 100%;
  display: block;
  background-size: cover;
}
.label-content {
  padding: 10px;
  .van-cell {
    font-size: 13px;
    line-height: 25px;
    background-color: #fff;
    border-bottom: 1px solid lightgray;
    padding: 5px 0;
    .van-field__label {
      font-weight: bold;
      text-align: left;
    }
    .van-field__control {
      text-align: right !important;
      font-size: 13px;
    }
  }
}
.border-bottom {
  border-bottom:1px solid lightgray;
}
.van-popup--center {
  top: 65%;
}
</style>

父组件参数

<template>
  <div id="app">
    <smarthubareasVant @kidChange="checkEditBills"></smarthubareasVant>
  </div>
</template>

<script>
import smarthubareasVant from "../packages/smarthubareasVant/smarthubareasVant.vue";
export default {
  components: {
    smarthubareasVant,
  },
  name: "App",
  data() {
    return {
      selectProvince: "",
      selectCity: "",
      selectArea: "",
    };
  },
  methods: {
    checkEditBills(data) {
      // console.log(data, 555555555555555);
      this.selectProvince = data.values[0].name;
      this.selectCity = data.values[1].name;
      this.selectArea = data.values[2].name;
    },
  },
};
</script>
<style lang="less">
@import url("./css/normal.css");
</style>