1.1.2 • Published 7 years ago

vue-semantic-dropdown v1.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

vue-semantic-dropdown

更支持vue的semantic风格下拉菜单

主要为了解决semantic的dropdown无法直接进行数据绑定,为正常使用也扩展了其他功能,保证使用过程的灵活顺滑~

安装

npm install vue-semantic-dropdown --save

使用

引入组件

// in your main.js
import Dropdown from 'vue-semantic-dropdown'

Vue.use(Dropdown)

在.vue中使用

<Dropdown addClass="selection" name="selection" defaultText="请选择"
          v-model="selectedValue" :options="options"
          textFiled="value" valueFiled="id"
          @dropdown-selected="(text) => { selectedText = text}"
></Dropdown>
<span>id: {{ selectedValue }} name:{{ selectedText }} </span>
...
data() {
    return {
        options: [
            {
                id: 'litteRed',
                value: '小红'
            },
            {
                id: 'litteBlue',
                value: '小蓝'
            }
        ],
        selectedValue: null,
        selectedText: null
   }
}

参数说明

Attributes

参数说明类型默认值必填
options下拉内容,数组内部可以是string或jsonArraynullrequired
nameinput的nameStringnullrequired
value选中值-nullrequired
defaultText默认显示内容Stringnullrequired
textFiled显示值的字段名,可修改,如'value'Stringtext
valueFiled选中值的字段名,可修改,如'id'Stringvalue
addClass需要增加的class,默认class只有'ui dropdown'Stringnull
action同semantic中的actionStringactivate
settingdropdown(setting)Object-required

默认初始化下拉菜单时dropdown()中带action和onchange两个参数属性

Events

参数说明类型默认值必填
dropdown-selected当同时存在value和text时可以获取到选中的textStringnull-

查看example

cd 此目录
npm i
npm run dev

For more information,checkout the github

1.1.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago