-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rate): rate组件库支持自定义图标前缀iconPrefix,适配第三方图标库
rate组件库支持自定义图标前缀iconPrefix,适配第三方图标库 fix #2327
- Loading branch information
1 parent
c16b567
commit 9fa21a8
Showing
14 changed files
with
168 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,4 +125,4 @@ | |
"dependencies": { | ||
"dayjs": "^1.10.7" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,39 +1,48 @@ | ||
<!-- | ||
* @Author: twinkleli [email protected] | ||
* @Date: 2023-08-29 09:53:44 | ||
* @LastEditors: twinkleli [email protected] | ||
* @LastEditTime: 2023-08-29 11:02:04 | ||
* @FilePath: /tdesign-miniprogram/src/rate/README.en-US.md | ||
* @Description: | ||
--> | ||
:: BASE_DOC :: | ||
|
||
## API | ||
### Rate Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
allow-half | Boolean | false | \- | N | ||
color | String / Array | '#ED7B2F' | `0.30.0`。Typescript:`string \| Array<string>` | N | ||
count | Number | 5 | \- | N | ||
disabled | Boolean | - | \- | N | ||
external-classes | Array | - | `['t-class', 't-class-icon', 't-class-text']` | N | ||
gap | String / Number | 8 | \- | N | ||
icon | String / Array | - | Typescript:`string \| string[]` | N | ||
show-text | Boolean | false | \- | N | ||
size | String | 24px | \- | N | ||
texts | Array | [] | Typescript:`Array<string>` | N | ||
value | Number | 0 | \- | N | ||
default-value | Number | undefined | uncontrolled property | N | ||
variant | String | outline | options:outline/filled | N | ||
| name | type | default | description | required | | ||
| ---------------- | --------------- | --------- | ----------------------------------------------- | -------- | | ||
| allow-half | Boolean | false | \- | N | | ||
| color | String / Array | '#ED7B2F' | `0.30.0`。Typescript:`string \| Array<string>` | N | | ||
| count | Number | 5 | \- | N | | ||
| disabled | Boolean | - | \- | N | | ||
| external-classes | Array | - | `['t-class', 't-class-icon', 't-class-text']` | N | | ||
| gap | String / Number | 8 | \- | N | | ||
| icon | String / Array | - | Typescript:`string \| string[]` | N | | ||
| show-text | Boolean | false | \- | N | | ||
| size | String | 24px | \- | N | | ||
| texts | Array | [] | Typescript:`Array<string>` | N | | ||
| value | Number | 0 | \- | N | | ||
| default-value | Number | undefined | uncontrolled property | N | | ||
| iconPrefix | String | undefined | icon prefix | N | | ||
| variant | String | outline | options:outline/filled | N | | ||
|
||
### Rate Events | ||
|
||
name | params | description | ||
-- | -- | -- | ||
change | `(value: number)` | \- | ||
| name | params | description | | ||
| ------ | ----------------- | ----------- | | ||
| change | `(value: number)` | \- | | ||
|
||
|
||
### CSS Variables | ||
The component provides the following CSS variables, which can be used to customize styles. | ||
Name | Default Value | Description | ||
-- | -- | -- | ||
--td-rate-icon-scale | 1.33 | - | ||
--td-rate-selected-color | @warning-color | - | ||
--td-rate-text-active-color | @font-gray-1 | - | ||
--td-rate-text-active-font-weight | 600 | - | ||
--td-rate-text-color | @font-gray-4 | - | ||
--td-rate-text-font-size | @font-size-m | - | ||
--td-rate-unselected-color | @bg-color-secondarycomponent | - | ||
| Name | Default Value | Description | | ||
| --------------------------------- | ---------------------------- | ----------- | | ||
| --td-rate-icon-scale | 1.33 | - | | ||
| --td-rate-selected-color | @warning-color | - | | ||
| --td-rate-text-active-color | @font-gray-1 | - | | ||
| --td-rate-text-active-font-weight | 600 | - | | ||
| --td-rate-text-color | @font-gray-4 | - | | ||
| --td-rate-text-font-size | @font-size-m | - | | ||
| --td-rate-unselected-color | @bg-color-secondarycomponent | - | |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Component({ | ||
data: { | ||
value: 3, | ||
}, | ||
methods: { | ||
onChange(e) { | ||
const { value } = e.detail; | ||
this.setData({ | ||
value, | ||
}); | ||
}, | ||
}, | ||
}); |
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,6 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"t-rate": "tdesign-miniprogram/rate/rate" | ||
} | ||
} |
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,4 @@ | ||
<view class="demo-rate"> | ||
<view class="demo-rate__title">自定义icon前缀</view> | ||
<t-rate value="{{value}}" iconPrefix="icon" icon="a-1h" bind:change="onChange" /> | ||
</view> |
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,22 @@ | ||
.demo-rate { | ||
background-color: #fff; | ||
height: 96rpx; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 0 32rpx; | ||
border-bottom: solid 1rpx #f0f0f0; | ||
border-top: solid 1rpx #f0f0f0; | ||
margin-top: 32rpx; | ||
margin-bottom: 32rpx; | ||
} | ||
|
||
.demo-rate__title { | ||
width: 200rpx; | ||
} | ||
|
||
.demo-rate__transparent { | ||
background-color: transparent; | ||
padding-left: 32rpx; | ||
border: 0; | ||
} |
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,31 @@ | ||
@font-face { | ||
font-family: 'icon'; /* Project id 3144196 */ | ||
src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAPUAAsAAAAACGAAAAOFAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDGgqEPIQBATYCJAMUCwwABCAFhDcHQhtVBxHVmy/JfhzGjunMd9u7ZdNoJGL95+B5ckPfvzsIgZjoVHHRKe1qNlEdfUoAPFpzlgKhvLdV7dpf4MyYhRbmw1+ObxM9+wDSmJP2okWn0XkEe1sWSOAJJR4mYA3TSx7kD48ggEsZ9VFNm7ftSsjYQVPHk4DBlwpUtTJ21IhBONyBmagVHAR76U6DbMQCtUo9BzZk75cfVIgDCkvjn9NxeLOhPPTb+R31wtqF6PckEgQ4WwEWoIGih7mk93SgK7pIF6FxhwKGPDTZIOB3rK312yWKZ//hgaDQGBAbvzoIgIYwY8BvFxEI+O0JFPgdCDT4HVVfpN0CwAWWfQ68w1yWUQUvFRUUEJMZ0zBmzKILZ26suXbqHGrh2ZNXV18/fV68hafWnInRi06vPskQ3VV6eKqH9vB2nPDWbNu2C1xZtH31VhgiPfbE7kmo2ba78+R9oy6cueOtuXVuHwt3+kNEdfVYNWfEmhMii067q3cK6kYqetu26F2w6GjUtlO79uXprVE7b7r38YsHl62wxmwPBrvdDvyl7A2Os2v65berseOS461n/fL6PbPim4dlpFSGJIdmpmSGMm3NvmaVrZtVNPePPcwtGCU9i0KcX3dKyKGCTUFnY9aHrCNjTeN5PzcGxQd6498Eh4WH5zXPjbbvdIxJHLz4dnx4QLNlC4Y/nd98/MZvwLSjqfOTGoRGhEX8dfOa50XbtyfEJHVbM+JAnW7F8SnLQr7+lxVUpFRN6PF4ZnpY62/ZybnNs8Ki0qIimiWf7HroYciPBM85E3+uGqdmAKjPamomzPiEAAJN2zkJA0Lr/nY8A8DHwLJq4DAszzgoYIrfbuy7UNRYGTKaoc7Ih2BddD9goQJcXKDWj0Tw8RhT5OIkCKahZFAEEAuNIYUyXAYsPHJgYyiHSyHV+z0iGYhGTCCQwxQAwWEXFCEcgsbhAmW4G7CI4QFsHF7AxXn+ZQ85QYZDxpFxgekHag6eQj1npVcULztmKY8ST8xFwTh0dVvPXdBjXrOmvEXPTEA5ODhvvQ+tDRBz0DhzLZnjvmlo6Cn1HNzqkHFkXIDpB6g5eEos3Fx+RfGyYx5QZ74nQl3hclgPdNS0E9TF4Ce7XrS+vEUPMwFkq4MDzlf70AbpAMThaRpnrpEbknFPg8RoqaG+1uTekpz14a+2RIkWI5bYbAdV7S6ydTKm+/ggVysAAAA=') | ||
format('woff2'), | ||
url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.woff?t=1642299317916') format('woff'), | ||
url('//at.alicdn.com/t/font_3144196_s14ifjx2cyi.ttf?t=1642299317916') format('truetype'); | ||
} | ||
|
||
.icon { | ||
font-family: 'icon' !important; | ||
font-size: 16px; | ||
font-style: normal; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
.icon-a-0:before { | ||
content: '\e64d'; | ||
} | ||
|
||
.icon-a-1h:before { | ||
content: '\e64e'; | ||
} | ||
|
||
.icon-a-2h:before { | ||
content: '\e64f'; | ||
} | ||
|
||
.icon-a-3h:before { | ||
content: '\e650'; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import './iconfont.wxss'; |
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