-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://gitee.com/yudaocode/yudao-ui-admin-vue3
- Loading branch information
Showing
23 changed files
with
888 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/views/mall/product/category/components/ProductCategorySelect.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<el-tree-select | ||
v-model="selectCategoryId" | ||
:data="categoryList" | ||
:props="defaultProps" | ||
:multiple="multiple" | ||
:show-checkbox="multiple" | ||
class="w-1/1" | ||
node-key="id" | ||
placeholder="请选择商品分类" | ||
/> | ||
</template> | ||
<script lang="ts" setup> | ||
import { defaultProps, handleTree } from '@/utils/tree' | ||
import * as ProductCategoryApi from '@/api/mall/product/category' | ||
import { oneOfType } from 'vue-types' | ||
import { propTypes } from '@/utils/propTypes' | ||
/** 商品分类选择组件 */ | ||
defineOptions({ name: 'ProductCategorySelect' }) | ||
const props = defineProps({ | ||
modelValue: oneOfType([propTypes.number.def(undefined), propTypes.array.def([])]).def(undefined), // 选中的ID | ||
multiple: propTypes.bool.def(false) // 是否多选 | ||
}) | ||
/** 选中的分类 ID */ | ||
const selectCategoryId = computed({ | ||
get: () => { | ||
return props.modelValue | ||
}, | ||
set: (val: number | number[]) => { | ||
emit('update:modelValue', val) | ||
} | ||
}) | ||
/** 分类选择 */ | ||
const emit = defineEmits(['update:modelValue']) | ||
/** 初始化 **/ | ||
const categoryList = ref([]) // 分类树 | ||
onMounted(async () => { | ||
// 获得分类树 | ||
const data = await ProductCategoryApi.getCategoryList({}) | ||
categoryList.value = handleTree(data, 'id', 'parentId') | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.