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

v_select

v1.0.4

Published

Vue select component

Downloads

3

Readme

v_select


Description

A vue select component. With this component,we can use the Ajax to get data from the back end api,then select components we need will be generated dynamically.

Development Setup

# install fis3
npm install fis3 -g

# install deps
npm install

# package with webpack
npm run dev

# build dist files
npm run build

# serve example app at localhost:8080 or localhost:8080/page/index.html
npm run start

Example

CommonJS

html

<div id="demo">
    <v-select :comps="comps"></v-select>
</div>

mock data

  • mock
    • data.js
    • data1 [ "九阳", "美的", "AGL" ]
    • data2
      • AGL [ "和面","绿豆","绞肉" ]
      • 九阳 [ "榨汁","制奶昔","碎肉","切菜" ]
      • 美的 [ "打蛋","搅拌","干磨","碎冰" ]
    • data3
      • 和面 [ "51","52","53" ]
      • 绿豆 [ "61","62","63" ]
      • 绞肉 [ "71","72","73" ]
      • 榨汁 [ "500ml","2.00L","1.5L" ] ...
      • 碎冰 [ "41","42","43" ]

data.js

{
    "comps":[
        {
            "id": "s1",
            "value": "",
            "label": {
                "text":"test1",
                "style":{ "isA" : true, "isB" : true }
            },
            "root": true,
            "cache": true,
            "url": "/mock/data1/data1",
            "refdom": "s2",
            "keyword": ""
        },
        {
            "id": "s2",
            "value": "",
            "label": {
                "text":"test2",
                "style":{ "isA" : true, "isB" : false }
            },
            "url": "/mock/data2/",
            "refdom": "s3",
            "keyword": ""
        },
        {
            "id": "s3",
            "value": "",
            "label": {
                "text":"test3",
                "style":{ "isA" : true, "isB" : false }
            },
            "url": "/mock/data3/",
            "refdom": "",
            "keyword": ""
        }
    ]
}

javascript

var Vue = require('vue');
var v_select = require('v_select');

Vue.component('v-select', v_select);

// create a root instance
new Vue({
    el: '#demo',
    data: require('./mock/data')
})

OR

<div id="demo">
    <v-select :comps="comps"></v-select>
</div>
<script src="vue.min.js" charset="utf-8"></script>
<script src="../mock/data.js" charset="utf-8"></script>
<script src="../dist/v_select.js" charset="utf-8"></script>
<script type="text/javascript">
    Vue.component('v-select',v_select);

    // create a root instance
    var demo = new Vue({
        el: '#demo',
        data: data
    })
</script>

Property

  • id - select component id (required)
  • label - select component label
  • value - select component value (required)
  • options - select component options
  • refdom - a select component id,the options of its corresponding component would be refresh when its parent component's value is changed
  • keyword - selected value of its parent component
  • cache - timestamp will be added to the url of fetching data when it is true
  • root - it is true when the component is the root or the first node (required)
  • url - url of g=fetch data from mock/api
  • __default__ - default options value

License

MIT

Copyright (c) 2016 Darebeat