0.1.8 • Published 4 years ago

vue-easy-comp v0.1.8

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

vue-easy-comp

The purpose of this module is to gather common components without any styles.

Select

Properties

NametypeRequiredDefault valueDescription
classesstring[]false-Allow to add class to the select element.
disabledbooleanfalsefalseAllow to disabled the select.
idstringfalse-Allow to add an id on the select element.
itemsstring[] or object[]true-The list of item to use in the select.
optionsobjectfalseSee belowAdditinal option for the component.
v-modelobject or stringtrue-The selected value on the select element.

Options

NametypeDefault valueDescription
descriptionFieldstring""Used when items is an array of object. Determine the object propertie to use as label in the option elements. If empty it will consider item as an string array.
idFieldstring""Used when items is an array of object. Determine the object propertie to use as id in the option elements. If empty it will use the index.

Events

  • @change

Examples

String array

<template>
    <SelectComponent v-model="selected" :items="items"></SelectComponent>
</template>
<script>
import {SelectComponent} from 'vue-easy-comp';

export default {
    components:{SelectComponent},
    data(){
        return {
            items: ['Tadeus', 'Thomenn', 'Thingol'],
            selected: 'Tadeus'
        }
    }
};
</script>

Object array

<template>
    <SelectComponent 
        v-model="selected" 
        :items="items" 
        :options="options" 
        :classes="classes" 
        :disabled="disabled
        @change="onChange">
    </SelectComponent>
</template>
<script>
import {SelectComponent} from 'vue-easy-comp';

export default {
    components:{SelectComponent},
    data(){
        return {
            items: [{name: 'Tadeus', num: 99}, {name: 'Thomenn',num: 79} {name: 'Thingol', num: 42}],
            selected: {name: 'Tadeus', num: 99},
            classes: ['css-select-class'],
            options: {
                descriptionField: "name",
                idField: "num"
            },
            disabled: true
        },
        methods: {
            onChange(newValue){
                ... 
            }
        }
    };

};
</script>

nav

Properties

NametypeRequiredDefault valueDescription
classesstring[]false-Allow to add class to the select element.
idstringfalse-Allow to add an id on the select element.
itemsstring[] or object[]true-The list of item to use in the select.
optionsobjectfalseSee belowAdditinal option for the component.
v-modelobject or stringtrue-The selected value on the select element.

Options

NametypeDefault valueDescription
descriptionFieldstring""Used when items is an array of object. Determine the object propertie to use as label in the option elements. If empty it will consider item as an string array.
idFieldstring""Used when items is an array of object. Determine the object propertie to use as id in the option elements. If empty it will use the index.

Events

  • @change

Examples

String array

<template>
    <NavComponent v-model="selected" :items="items"></NavComponent>
</template>
<script>
import {NavComponent} from 'vue-easy-comp';

export default {
    components:{NavComponent},
    data(){
        return {
            items: ['Tadeus', 'Thomenn', 'Thingol'],
            selected: 'Tadeus'
        }
    }
};
</script>

Object array

<template>
    <NavComponent 
        v-model="selected" 
        :items="items" 
        :options="options" 
        :classes="classes" 
        @change="onChange">
    </NavComponent>
</template>
<script>
import {NavComponent} from 'vue-easy-comp';

export default {
    components:{NavComponent},
    data(){
        return {
            items: [{name: 'Tadeus', num: 99}, {name: 'Thomenn',num: 79} {name: 'Thingol', num: 42}],
            selected: {name: 'Tadeus', num: 99},
            classes: ['css-select-class'],
            options: {
                descriptionField: "name",
                idField: "num"
            },
            disabled: true
        },
        methods: {
            onChange(newValue){
                ... 
            }
        }
    };

};
</script>
0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago