项目初始化
This commit is contained in:
67
pages/tabbar/components/home/categorySheet.vue
Normal file
67
pages/tabbar/components/home/categorySheet.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<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>
|
Reference in New Issue
Block a user