0.1.3 • Published 5 years ago

vue-letter-nav v0.1.3

Weekly downloads
17
License
-
Repository
github
Last release
5 years ago

vue-letter-nav

一个基于vue的字母导航组件

demo 注:请F12,选择手机模式查看,或者本地运行在手机浏览器上的查看

使用

# 安装 npm 包
npm install -S vue-letter-nav

# 项目引入css
import "~vue-letter-nav/lib/vue-letter-nav.css";

# 项目main.js引入组件, 全局引入

import VueLetterNav from 'vue-letter-nav'

Vue.use(VueLetterNav)

构建命令

# 安装依赖
npm install

# 启动本地服务(默认localhost与ip) localhost:8080
npm run dev

# 打包示例
npm run bulid

Api

参数描述类型可选值必须默认值
check已选中的值,一维数组Arraytrue[]
list全部的数据Array {'alpha': 'A', name: '用户', value: 'Account'} true[]
multiple是否多选Booleanfalsefalse
readonly是否只读Booleanfalsefalse
showLetter显示字母导航Booleanfalsetrue
scrollOptions滚动行为Objectfalse
#
list数据格式如下: {
    name: '安哥拉',
    value: 'Angola',
    alpha: 'A'
}, {
    name: '阿富汗',
    value: 'Afghanistan'
}, {
    name: '阿尔巴尼亚',
    value: 'Albania'
}, {
    name: '巴哈马',
    value: 'Bahamas',
    alpha: 'B'
}, {
    name: '巴林',
    value: 'Bahrain'
}

scrollOptions API

因为引用了 MDN: scrollIntoView(),故可参考其相关配置

参数描述类型可选值必须默认值
behavior定义滚动动画Stringauto(自动)| instant(无滚动)| smooth(缓动)falseauto
block设置滚动指定元素位置Stringstart(顶部)| center(居中)| end(底部)| nearest(最近的)falsecenter
inline设置滚动指定元素位置Stringstart(顶部)| center(居中)| end(底部)| nearest(最近的)falsecenter

slot

参数描述类型可选值必须默认值
content子项内容
#
支持slot, 可以自定义slot子项的内容, 如下所示# data为的子项的数据, 格式: {
    name: '',
    value: ''
}

vue - letter - nav(: check = "checkList": list = "allList": multiple = "true": readonly = "false"
    @check = "handleCheck")
template(slot = "content"
    slot - scope = "{data}")
span.letter - content - icon√
span {
    {
        data.name
    }
}

更新日志

0.1.0

  1. 基础版本发布

0.1.1

  1. 增加scrollOptions配置

0.1.3

  1. 升级依赖
0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago