From 4d15b63e324ed023a5689226519d17425e23a922 Mon Sep 17 00:00:00 2001 From: Eiinu Date: Thu, 27 Jul 2023 16:29:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(category):=20=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E4=B8=8E=E5=88=97=E8=A1=A8=E6=94=AF=E6=8C=81=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/__VUE/category/demo.vue | 148 +++++++++--------- src/packages/__VUE/category/doc.en-US.md | 56 +------ src/packages/__VUE/category/doc.md | 56 +------ src/packages/__VUE/category/doc.taro.md | 48 +----- src/packages/__VUE/category/index.scss | 14 +- src/packages/__VUE/category/index.taro.vue | 45 ++---- src/packages/__VUE/category/index.vue | 46 ++---- src/packages/__VUE/category/types.ts | 1 + src/packages/__VUE/categorypane/index.scss | 4 +- .../__VUE/categorypane/index.taro.vue | 22 +-- src/packages/__VUE/categorypane/index.vue | 22 +-- 11 files changed, 140 insertions(+), 322 deletions(-) create mode 100644 src/packages/__VUE/category/types.ts diff --git a/src/packages/__VUE/category/demo.vue b/src/packages/__VUE/category/demo.vue index 49839c11ca..b1344a8356 100644 --- a/src/packages/__VUE/category/demo.vue +++ b/src/packages/__VUE/category/demo.vue @@ -1,24 +1,33 @@ - - - diff --git a/src/packages/__VUE/category/doc.en-US.md b/src/packages/__VUE/category/doc.en-US.md index d43fb0f613..68772cce27 100644 --- a/src/packages/__VUE/category/doc.en-US.md +++ b/src/packages/__VUE/category/doc.en-US.md @@ -25,7 +25,7 @@ data defination ```html -``` - -::: - ## API ### Category Props @@ -206,9 +160,9 @@ data defination ### CategoryPane Events -| Event | Description | Arguments | -| --------- | ------------------------------------------ | ------------ | -| on-change | Click on the right classified data trigger | Clicked data | +| Event | Description | Arguments | +| ------ | ------------------------------------------ | ------------ | +| change | Click on the right classified data trigger | Clicked data | ### CategoryPane Slots diff --git a/src/packages/__VUE/category/doc.md b/src/packages/__VUE/category/doc.md index 470269dad8..6ef82c2251 100644 --- a/src/packages/__VUE/category/doc.md +++ b/src/packages/__VUE/category/doc.md @@ -25,7 +25,7 @@ data 数据格式可参考 ```html -``` - -::: - ## API ### Category Props @@ -206,9 +160,9 @@ data 数据格式可参考 ### CategoryPane Events -| 事件名 | 说明 | 回调参数 | -| --------- | -------------------- | ---------- | -| on-change | 点击右侧分类数据触发 | 点击的数据 | +| 事件名 | 说明 | 回调参数 | +| ------ | -------------------- | ---------- | +| change | 点击右侧分类数据触发 | 点击的数据 | ### CategoryPane Slots diff --git a/src/packages/__VUE/category/doc.taro.md b/src/packages/__VUE/category/doc.taro.md index 544194e35e..00bbd64781 100644 --- a/src/packages/__VUE/category/doc.taro.md +++ b/src/packages/__VUE/category/doc.taro.md @@ -25,7 +25,7 @@ data 数据格式可参考 ```html -``` - -::: - ## API ### Category Props @@ -172,9 +134,9 @@ data 数据格式可参考 ### CategoryPane Events -| 事件名 | 说明 | 回调参数 | -| --------- | -------------------- | ---------- | -| on-change | 点击右侧分类数据触发 | 点击的数据 | +| 事件名 | 说明 | 回调参数 | +| ------ | -------------------- | ---------- | +| change | 点击右侧分类数据触发 | 点击的数据 | ### CategoryPane Slots diff --git a/src/packages/__VUE/category/index.scss b/src/packages/__VUE/category/index.scss index b816a4b380..9c760d7c2a 100644 --- a/src/packages/__VUE/category/index.scss +++ b/src/packages/__VUE/category/index.scss @@ -1,8 +1,6 @@ .nut-theme-dark { .nut-category { - &__cateList { - background: $dark-background2; - } + background: $dark-background2; &__cateListLeft { background: $dark-background4; @@ -20,9 +18,12 @@ } } .nut-category { - &__cateList { - display: flex; - background: $category-bg-color; + display: flex; + background: $category-bg-color; + + &__nav { + min-width: 100px; + overflow-y: auto; } &__cateListLeft { @@ -34,7 +35,6 @@ width: 100px; height: 50px; font-size: 13px; - font-family: PingFangSC; font-weight: normal; color: $category-list-item-color; display: flex; diff --git a/src/packages/__VUE/category/index.taro.vue b/src/packages/__VUE/category/index.taro.vue index 8ef9df5052..0813eaa737 100644 --- a/src/packages/__VUE/category/index.taro.vue +++ b/src/packages/__VUE/category/index.taro.vue @@ -1,60 +1,43 @@ diff --git a/src/packages/__VUE/category/index.vue b/src/packages/__VUE/category/index.vue index afa22626ea..0813eaa737 100644 --- a/src/packages/__VUE/category/index.vue +++ b/src/packages/__VUE/category/index.vue @@ -1,59 +1,43 @@ diff --git a/src/packages/__VUE/category/types.ts b/src/packages/__VUE/category/types.ts new file mode 100644 index 0000000000..571972f326 --- /dev/null +++ b/src/packages/__VUE/category/types.ts @@ -0,0 +1 @@ +export type CategoryType = 'classify' | 'text' | 'custom'; diff --git a/src/packages/__VUE/categorypane/index.scss b/src/packages/__VUE/categorypane/index.scss index a4c4acc490..be9af4f966 100644 --- a/src/packages/__VUE/categorypane/index.scss +++ b/src/packages/__VUE/categorypane/index.scss @@ -9,6 +9,7 @@ } } .nut-category-pane { + overflow-y: auto; &__cateListRight { padding-left: 15px; background: $category-bg-color; @@ -17,7 +18,6 @@ margin-top: 15px; margin-bottom: 15px; font-size: 13px; - font-family: PingFangSC; font-weight: 500; color: $category-pane-title-color; } @@ -45,7 +45,6 @@ border: 1px solid $category-pane-border-color; border-radius: 5px; font-size: 12px; - font-family: PingFangSC; font-weight: normal; color: $category-pane-gray-color; display: flex; @@ -62,7 +61,6 @@ &__skuImg { font-size: 12px; - font-family: PingFangSC; font-weight: normal; color: $category-pane-gray-color; margin-top: 10px; diff --git a/src/packages/__VUE/categorypane/index.taro.vue b/src/packages/__VUE/categorypane/index.taro.vue index c2fba5245c..5f45d9239d 100644 --- a/src/packages/__VUE/categorypane/index.taro.vue +++ b/src/packages/__VUE/categorypane/index.taro.vue @@ -48,6 +48,7 @@ diff --git a/src/packages/__VUE/categorypane/index.vue b/src/packages/__VUE/categorypane/index.vue index c2fba5245c..5f45d9239d 100644 --- a/src/packages/__VUE/categorypane/index.vue +++ b/src/packages/__VUE/categorypane/index.vue @@ -48,6 +48,7 @@ From 34c7f794f1c3eeb82ed8c52c64b5959265953c7c Mon Sep 17 00:00:00 2001 From: Eiinu Date: Thu, 27 Jul 2023 20:07:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(category):=20=E6=96=B0=E5=A2=9E=20opti?= =?UTF-8?q?onKey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/__VUE/category/doc.en-US.md | 35 ++++++++++------------ src/packages/__VUE/category/doc.md | 35 ++++++++++------------ src/packages/__VUE/category/doc.taro.md | 35 ++++++++++------------ src/packages/__VUE/category/index.taro.vue | 27 ++++++++++------- src/packages/__VUE/category/index.vue | 27 ++++++++++------- src/packages/__VUE/category/types.ts | 11 +++++++ 6 files changed, 88 insertions(+), 82 deletions(-) diff --git a/src/packages/__VUE/category/doc.en-US.md b/src/packages/__VUE/category/doc.en-US.md index 68772cce27..58dc7910a4 100644 --- a/src/packages/__VUE/category/doc.en-US.md +++ b/src/packages/__VUE/category/doc.en-US.md @@ -134,42 +134,37 @@ data defination ::: -## API +## Category -### Category Props +### Props -| Attribute | Description | Type | Default | -| --------- | ------------------------------------------------- | ------ | ---------- | -| type | Classification mode: `classify`, `text`, `custom` | string | `classify` | -| category | Left navigation bar data list | Array | `[]` | +| Attribute | Description | Type | Default | +| ---------------- | --------------------------------------- | ------ | ---------------------------------------- | +| type | Classification mode: `classify`, `text` | string | `classify` | +| category | Left navigation bar data list | Array | `[]` | +| optionKey`4.1.3` | Custom keys in `category` | Object | `{ catId: 'catId', catName: 'catName' }` | -### Category Events +### Events -| Event | Description | Arguments | -| ------------- | ----------------------------------------------------------------------------------------------- | ---------------- | -| change | Classic classification, click on the left navigation bar to get the data list on the right | Clicked data | -| change-text | In text classification mode, click on the left navigation bar to get the data list on the right | Input data | -| change-custom | Customize, click the left navigation bar to get the data list on the right | Current quantity | +| Event | Description | Arguments | +| ------ | ------------------------------------------------------------------------------------------ | ------------ | +| change | Classic classification, click on the left navigation bar to get the data list on the right | Clicked data | -### CategoryPane Props +## CategoryPane + +### Props | Attribute | Description | Type | Default | | --------------- | --------------------------------------------------------- | ----- | ------- | | category-child | The current classification data is displayed on the right | Array | `[]` | | custom-category | Custom categorical data | Array | `[]` | -### CategoryPane Events +### Events | Event | Description | Arguments | | ------ | ------------------------------------------ | ------------ | | change | Click on the right classified data trigger | Clicked data | -### CategoryPane Slots - -| Name | Description | -| ------- | -------------- | -| default | Custom content | - ## Theming ### CSS Variables diff --git a/src/packages/__VUE/category/doc.md b/src/packages/__VUE/category/doc.md index 6ef82c2251..7b47f127bf 100644 --- a/src/packages/__VUE/category/doc.md +++ b/src/packages/__VUE/category/doc.md @@ -134,42 +134,37 @@ data 数据格式可参考 ::: -## API +## Category -### Category Props +### Props -| 参数 | 说明 | 类型 | 默认值 | -| -------- | -------------------------------------- | ------ | ---------- | -| type | 分类模式:`classify`,`text`,`custom` | string | `classify` | -| category | 左侧导航栏数据列表 | Array | `[]` | +| 参数 | 说明 | 类型 | 默认值 | +| ---------------- | ------------------------------ | ------ | ---------------------------------------- | +| type | 分类模式:`classify`,`text` | string | `classify` | +| category | 左侧导航栏数据列表 | Array | `[]` | +| optionKey`4.1.3` | 自定义 `category` 中的参数 key | Object | `{ catId: 'catId', catName: 'catName' }` | -### Category Events +### Events -| 事件名 | 说明 | 回调参数 | -| ------------- | ------------------------------------------------ | ---------- | -| change | 经典分类,点击左侧导航栏,获取右侧数据列表 | 点击的数据 | -| change-text | 文本分类模式,更点击左侧导航栏,获取右侧数据列表 | 输入的数据 | -| change-custom | 自定义,点击左侧导航栏,获取右侧数据列表 | 当前数量 | +| 事件名 | 说明 | 回调参数 | +| ------ | ------------------------------------------ | ---------- | +| change | 经典分类,点击左侧导航栏,获取右侧数据列表 | 点击的数据 | -### CategoryPane Props +## CategoryPane + +### Props | 参数 | 说明 | 类型 | 默认值 | | --------------- | -------------------- | ----- | ------ | | category-child | 右侧展示当前分类数据 | Array | `[]` | | custom-category | 自定义分类数据 | Array | `[]` | -### CategoryPane Events +### Events | 事件名 | 说明 | 回调参数 | | ------ | -------------------- | ---------- | | change | 点击右侧分类数据触发 | 点击的数据 | -### CategoryPane Slots - -| 名称 | 说明 | -| ------- | ---------- | -| default | 自定义内容 | - ## 主题定制 ### 样式变量 diff --git a/src/packages/__VUE/category/doc.taro.md b/src/packages/__VUE/category/doc.taro.md index 00bbd64781..f608547000 100644 --- a/src/packages/__VUE/category/doc.taro.md +++ b/src/packages/__VUE/category/doc.taro.md @@ -108,42 +108,37 @@ data 数据格式可参考 ::: -## API +## Category -### Category Props +### Props -| 参数 | 说明 | 类型 | 默认值 | -| -------- | -------------------------------------- | ------ | ---------- | -| type | 分类模式:`classify`,`text`,`custom` | string | `classify` | -| category | 左侧导航栏数据列表 | Array | `[]` | +| 参数 | 说明 | 类型 | 默认值 | +| ---------------- | ------------------------------ | ------ | ---------------------------------------- | +| type | 分类模式:`classify`,`text` | string | `classify` | +| category | 左侧导航栏数据列表 | Array | `[]` | +| optionKey`4.1.3` | 自定义 `category` 中的参数 key | Object | `{ catId: 'catId', catName: 'catName' }` | -### Category Events +### Events -| 事件名 | 说明 | 回调参数 | -| ------------- | ------------------------------------------------ | ---------- | -| change | 经典分类,点击左侧导航栏,获取右侧数据列表 | 点击的数据 | -| change-text | 文本分类模式,更点击左侧导航栏,获取右侧数据列表 | 输入的数据 | -| change-custom | 自定义,点击左侧导航栏,获取右侧数据列表 | 当前数量 | +| 事件名 | 说明 | 回调参数 | +| ------ | ------------------------------------------ | ---------- | +| change | 经典分类,点击左侧导航栏,获取右侧数据列表 | 点击的数据 | -### CategoryPane Props +## CategoryPane + +### Props | 参数 | 说明 | 类型 | 默认值 | | --------------- | -------------------- | ----- | ------ | | category-child | 右侧展示当前分类数据 | Array | `[]` | | custom-category | 自定义分类数据 | Array | `[]` | -### CategoryPane Events +### Events | 事件名 | 说明 | 回调参数 | | ------ | -------------------- | ---------- | | change | 点击右侧分类数据触发 | 点击的数据 | -### CategoryPane Slots - -| 名称 | 说明 | -| ------- | ---------- | -| default | 自定义内容 | - ## 主题定制 ### 样式变量 diff --git a/src/packages/__VUE/category/index.taro.vue b/src/packages/__VUE/category/index.taro.vue index 0813eaa737..929d5d205d 100644 --- a/src/packages/__VUE/category/index.taro.vue +++ b/src/packages/__VUE/category/index.taro.vue @@ -1,22 +1,21 @@ diff --git a/src/packages/__VUE/category/index.vue b/src/packages/__VUE/category/index.vue index 0813eaa737..929d5d205d 100644 --- a/src/packages/__VUE/category/index.vue +++ b/src/packages/__VUE/category/index.vue @@ -1,22 +1,21 @@ diff --git a/src/packages/__VUE/category/types.ts b/src/packages/__VUE/category/types.ts index 571972f326..1755bf438b 100644 --- a/src/packages/__VUE/category/types.ts +++ b/src/packages/__VUE/category/types.ts @@ -1 +1,12 @@ export type CategoryType = 'classify' | 'text' | 'custom'; +export type CategoryNavItem = { + catName?: string; + catId?: string; + // custom + [key: PropertyKey]: any; +}; + +export type CategoryOptionKey = { + catName?: string; + catId?: string; +};