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 🙏

© 2026 – Pkg Stats / Ryan Hefner

lshop

v1.0.4

Published

自定义移动端购物车插件

Readme

安装

npm i lshop

main.js中使用

// 全局注册组件 import LShop from 'LShop' Vue.use(LShop)

页面中使用

<LShop
  :shopList="shopList"
  :allselected="allselected"
  :emptyTitle="emptyTitle"
  :money="money"
  :num="num"
  :showIcon="showIcon"
  :noneIcon="noneIcon"
  :deleteIcon="deleteIcon"
  @delerte="delerte"
  @radios="radios"
  @btn_add="btn_add"
  @btn_minute="btn_minute"
  @Allradios="Allradios"
  @GetSave="GetSave"
>
</LShop>

参数描述

     是否全选
      allselected: false,
      showIcon:"",
      noneIcon:"",
      deleteIcon:"",
      // 空数据状态
      emptyTitle: "购物车为空~",
      //默认总价
      money: 0,
      //默认总数量
      num: 0,
      //购物车假数据
      shopList: [
        {
          name: "购物车插件",
          num: 1,
          money: 10,
          src: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-110c136f-036c-47c5-af52-fcf8719fbf54/6d89bb46-efd4-4bba-a195-d38129f9e747.jpg",
          title: "仅仅是一个简单的自定义购物车插件",
          selected: true,
        },
        {
          name: "购物车插件",
          num: 1,
          money: 10,
          src: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-110c136f-036c-47c5-af52-fcf8719fbf54/6d89bb46-efd4-4bba-a195-d38129f9e747.jpg",
          title: "仅仅是一个简单的自定义购物车插件",
          selected: false,
        },
        {
          name: "购物车插件",
          num: 1,
          money: 10,
          src: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-110c136f-036c-47c5-af52-fcf8719fbf54/6d89bb46-efd4-4bba-a195-d38129f9e747.jpg",
          title: "仅仅是一个简单的自定义购物车插件",
          selected: true,
        },
      ],
# 方法
 /**
     * 输入框计算总价以及数量
     */
    bnt_input(index) {
      // 这里设置限制最大
      console.log(index);
      var shopList = this.shopList;
      var num = parseInt(shopList[index].num);
      if (num > 1 && num < 100) {
        this.allPrice();
      } else {
        shopList[index].num = 1;
        this.$mess;
      }
    },
    //总价总数量方法   方便调用   再次多写了一次[可以跟初始化封装为一个方法]
    allPrice: function () {
      var price = 0;
      var numb = 0;
      var shopList = this.shopList;
      for (var i = 0; i < shopList.length; i++) {
        if (shopList[i].selected) {
          price += parseInt(shopList[i].num) * shopList[i].money;
          numb += parseInt(shopList[i].num);
        }
      }
      this.money = price;
      this.num = numb;
    },
    //删除购物车列表
    delerte: function (index) {
      this.shopList.splice(index, 1);
      this.allPrice();
    },
    //选中未选中
    radios: function (index) {
      var shopList = this.shopList;
      shopList[index].selected = !shopList[index].selected;
      this.allPrice();
    },
    //添加
    btn_add: function (index) {
      var shopList = this.shopList;
      var num = parseInt(shopList[index].num);
      num = num + 1;
      shopList[index].num = num;
      this.allPrice();
    },
    //减去
    btn_minute: function (index) {
      var shopList = this.shopList;
      var num = parseInt(shopList[index].num);
      if (num > 1) {
        num = num - 1;
        shopList[index].num = num;
      }
      this.allPrice();
    },
    /**
     * 全选
     */
    Allradios() {
      var that = this;
      // 第一步更改全选状态  true/false
      that.allselected = !that.allselected;
      // 循环遍历购物车数据
      for (var i in this.shopList) {
        // 全选为true时,列表购物车都选中、false时列表购物车都不选中
        if (that.allselected) {
          this.shopList[i].selected = true;
        } else {
          this.shopList[i].selected = false;
        }
      }
      // 刷新一下总价
      this.allPrice();
    },
    /**
     * 提交
     */
    GetSave() {
      var list = [];
      list = this.shopList.filter((item) => {
        if (item.selected) {
          return true;
        }
      });
        console.log("提交",list);
    },