Files
peiwan-uniapp/pages/tabbar/components/home/categorySheet.vue
2025-01-21 01:46:34 +08:00

67 lines
1.3 KiB
Vue

<template>
<view>
<action-sheet zIndex="9999" :show="showActionSheet" :item-list="categoryList" @click="itemClick" @cancel="closeActionSheet"></action-sheet>
</view>
</template>
<script>
import ActionSheet from '@/pages/tabbar/components/home/actionSheet.vue';
import sheep from '@/sheep';
export default {
components: {
ActionSheet,
},
props: {
},
data() {
return {
showActionSheet: false,
}
},
computed: {
categoryList() {
var cateList = [];
var cate = {
text: "全部",
label: '项目分类',
value: '',
color: "#2B2B2B"
};
cateList.push(cate);
var dataList = sheep.$store('sys').categoryList;
for(var i=0;i<dataList.length;i++){
var category = {
text: "",
label: '',
value: '',
color: "#2B2B2B"
};
category.text = dataList[i].name;
category.label = dataList[i].name;
category.value = dataList[i].id;
cateList.push(category);
}
return cateList;
},
},
methods: {
//隐藏组件
closeActionSheet() {
this.showActionSheet = false
},
//调用此方法显示组件
openActionSheet() {
this.showActionSheet = true;
},
itemClick(e) {
this.$emit('categoryOk', e);
this.closeActionSheet();
},
}
}
</script>
<style lang="scss" scoped>
</style>