# chenchuang-CCDropDownFilter
#### 使用方法
```使用方法
<view style="width: 100vw; height: 40px; background-color: white;">
<!-- filterData:筛选数据 defaultIndex: 默认选择序列 @onSelected:选择事件 返回选择的值-->
<chenchuang-CCDropDownFilter :filterData='filterData' :defaultIndex='defaultIndex'
@onSelected='onSelected'></chenchuang-CCDropDownFilter>
</view>
```
#### HTML代码实现部分
```html
<template>
<view class="content">
<view style="margin-top: 16px;">
<view style="width: 100vw; height: 40px; background-color: white;">
<!-- filterData:筛选数据 defaultIndex: 默认选择序列 @onSelected:选择事件 返回选择的值-->
<chenchuang-CCDropDownFilter :filterData='filterData' :defaultIndex='defaultIndex'
@onSelected='onSelected'></chenchuang-CCDropDownFilter>
</view>
</view>
</view>
</template>
<script>
export default {
components: {
},
data() {
return {
filterData: [
[{
name: '全省',
value: ''
}],
[{
name: '美食',
value: ''
},
{
name: '湘菜',
value: '1'
},
{
name: '川菜',
value: '2'
},
{
name: '火锅',
value: '3'
}
],
[{
name: '排序',
value: ''
},
{
name: '好评优先',
value: '1'
},
{
name: '销量优先',
value: '2'
},
{
name: '低价优先',
value: '3'
}
],
[{
name: '筛选',
value: ''
},
{
name: '筛选1',
value: '1'
},
{
name: '筛选2',
value: '2'
}
],
],
defaultIndex: [0, 0, 0, 0]
}
},
mounted() {
let cityArr = ['广州市', '深圳市', '佛山市', '东莞市', '中山市', '珠海市', '江门市', '肇庆市', '惠州市', '汕头市', '潮州市', '揭阳市', '汕尾市',
'湛江市', '茂名市', '阳江市', '云浮市', '韶关市', '清远市', '梅州市', '河源市'
]
let tmpArr = this.filterData;
for (let s of cityArr) {
tmpArr[0].push({
name: s,
value: s
});
console.log("s = ", s);
}
console.log("filterData = " + JSON.stringify(this.filterData));
this.filterData = tmpArr;
},
methods: {
onSelected(res) {
console.log('选择res = ' + JSON.stringify(res));
uni.showModal({
title: '下拉筛选选择数据',
content: '所选择数据 = ' + JSON.stringify(res)
})
},
}
}
</script>
<style scoped>
page {
background-color: '#F6F7FA';
}
.content {
display: flex;
flex-direction: column;
/* background-color: white; */
}
.mui-content-padded {
margin: 6px 14px;
/* background-color: #ffffff; */
}
.lineV {
margin-top: 0px;
margin-left: 15px;
width: calc(100vw - 30px);
height: 1px;
background-color: #F5F5F5;
}
.hotSearchTitV {
margin-left: 14px;
margin-top: 4px;
width: 170px;
height: 22px;
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #161616;
line-height: 22px;
}
.upView {
display: flex;
flex-direction: row;
height: 26px;
margin-left: 0px;
}
.cellView {
margin-top: 4px;
margin-left: 5.8px;
height: 18px;
line-height: 18px;
text-align: center;
border-radius: 2px;
padding: 0px 4px !important;
font-size: 10px;
background-color: #f5f5f5;
color: #818183;
}
.moreBtn {
height: 30px;
/* background-color: #F5F5F5; */
text-align: center;
font-size: 12px;
line-height: 30px;
color: #888888;
}
</style>
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
随着技术的发展,开发的复杂度也越来越高,传统开发方式将一个系统做成了整块应用,经常出现的情况就是一个小小的改动或者一个小功能的增加可能会引起整体逻辑的修改,造成牵一发而动全身。通过组件化开发,可以有效实现单独开发,单独维护,而且他们之间可以随意的进行组合。大大提升开发效率低,降低维护成本。 CCDropDownFilter下拉菜单组件使用方法: <view style="width: 100vw; height: 40px; background-color: white;"> <!-- filterData:筛选数据 defaultIndex: 默认选择序列 @ed:选择事件 返回选择的值--> <chenchuang-CCDropDownFilter :filterData='filterData' :defaultIndex='defaultIndex' @ed='ed'></chenchuang-CCDropDownFilter> </view>
资源推荐
资源详情
资源评论
收起资源包目录
chenchuang-CCDropDownFilter_2.0.2_example.zip (13个子文件)
pages.json 452B
pages
index
index.vue 3KB
App.vue 270B
uni_modules
chenchuang-CCDropDownFilter
changelog.md 199B
readme.md 4KB
components
chenchuang-CCDropDownFilter
chenchuang-CCDropDownFilter.vue 7KB
package.json 2KB
manifest.json 2KB
main.js 352B
uni.scss 2KB
index.html 672B
uni.promisify.adaptor.js 309B
static
logo.png 4KB
共 13 条
- 1
资源评论
前端组件开发
- 粉丝: 1w+
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功