diff --git a/docs/guide/design-tokens.md b/docs/guide/design-tokens.md index d75f827..45ce624 100644 --- a/docs/guide/design-tokens.md +++ b/docs/guide/design-tokens.md @@ -35,7 +35,7 @@ |$color-secondary|
#4F5E83
|基础-次要颜色| |$color-disabled|
#ccc
|基础-禁用色| |$color-dark-grey|
#333
|基础-灰色| -|$color-dark-grey-s|
#323233
|基础-浅灰| +|$color-dark-grey-s|
#000000
|-| |$color-light-grey-opacity|
rgba(0, 0, 0, .04)
|基础-透明灰| |$mask-bgc_opacity|
rgba(37, 38, 45, 0.4)
|遮罩层背景| |$fill-bgc|
#f2f2f2
|基础-填充背景色| diff --git a/example/pages/rate/README.md b/example/pages/rate/README.md index 701ac44..edb508a 100644 --- a/example/pages/rate/README.md +++ b/example/pages/rate/README.md @@ -90,7 +90,7 @@ ### 自定义星星样式 -需要使用cube-rate-item组件,并且对自定义的星星元素定义两种样式——普通和活跃(在.cube-rate-item_active类之下, 如设置半星则也需修改.cube-rate-item_half_active类) +需要使用cube-rate-item组件,并且对自定义的星星元素定义两种样式——普通和活跃(在.cube-rate-item-def-active类之下, 如设置半星则也需修改.cube-rate-item-def-half-active类) #### 注意 使用自定义插槽时,因微信与支付宝在wx:for以数字为参数时,起始索引不同,为避免此问题请在wx:for遍历生成cube-rate-item时以数组为参数。 @@ -141,10 +141,10 @@ height: 100% background-size: 100% background-color: grey -.cube-rate-item_active +.cube-rate-item-def-active .cube-rate-item-demo background-color: orange -.cube-rate-item_half_active +.cube-rate-item-def-half-active .cube-rate-item-demo background-color: blue diff --git a/example/pages/rate/index.mpx b/example/pages/rate/index.mpx index 9c99302..72af355 100644 --- a/example/pages/rate/index.mpx +++ b/example/pages/rate/index.mpx @@ -184,10 +184,10 @@ .desc margin-top 15px -.cube-rate-item_active +.cube-rate-item-def-active .cube-rate-item-demo background-color: orange -.cube-rate-item_half_active +.cube-rate-item-def-half-active .cube-rate-item-demo background-color: blue diff --git a/packages/mpx-cube-ui/__tests__/components/rate/__snapshots__/rate.spec.js.snap b/packages/mpx-cube-ui/__tests__/components/rate/__snapshots__/rate.spec.js.snap index f518075..05f8814 100644 --- a/packages/mpx-cube-ui/__tests__/components/rate/__snapshots__/rate.spec.js.snap +++ b/packages/mpx-cube-ui/__tests__/components/rate/__snapshots__/rate.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`component rate unit test correct props check matchSnapshot 1`] = `""`; +exports[`component rate unit test correct props check matchSnapshot 1`] = `""`; -exports[`component rate unit test event trigger check matchSnapshot 1`] = `"当前分数的值: 1"`; +exports[`component rate unit test event trigger check matchSnapshot 1`] = `"当前分数的值: 1"`; -exports[`component rate unit test slot check matchSnapshot 1`] = `""`; +exports[`component rate unit test slot check matchSnapshot 1`] = `""`; -exports[`component rate unit test wx-model check matchSnapshot 1`] = `"当前分数的值: 1"`; +exports[`component rate unit test wx-model check matchSnapshot 1`] = `"当前分数的值: 1"`; diff --git a/packages/mpx-cube-ui/__tests__/components/rate/rate.spec.js b/packages/mpx-cube-ui/__tests__/components/rate/rate.spec.js index addeeac..7273e17 100644 --- a/packages/mpx-cube-ui/__tests__/components/rate/rate.spec.js +++ b/packages/mpx-cube-ui/__tests__/components/rate/rate.spec.js @@ -33,7 +33,7 @@ describe('component rate unit test', function () { it(' wx:model', async () => { // 确保 switchValue 首次显示符合预期 const rates = component.querySelector('rate').querySelectorAll('rate-item') - const rate1 = rates[0].querySelector('.cube-rate-item_active') + const rate1 = rates[0].querySelector('.cube-rate-item-def-active') const rate2 = rates[1].querySelector('.cube-rate-item-def') const rate3 = rates[2].querySelector('.cube-rate-item-def') // 确保 rate 首次显示符合预期 @@ -48,8 +48,8 @@ describe('component rate unit test', function () { component.instance.value = 2 await simulate.sleep(10) - const rateClicked1 = rates[0].querySelector('.cube-rate-item_active') - const rateClicked2 = rates[1].querySelector('.cube-rate-item_active') + const rateClicked1 = rates[0].querySelector('.cube-rate-item-def-active') + const rateClicked2 = rates[1].querySelector('.cube-rate-item-def-active') const rateClicked3 = rates[2].querySelector('.cube-rate-item-def') expect(component.instance.value).toBe(2) expect(rateClicked1 !== undefined).toBe(true) @@ -76,8 +76,8 @@ describe('component rate unit test', function () { it(' props to rate ', async () => { const rates = component.querySelectorAll('rate-item') const justify = component.querySelector('.cube-rate-justify') - const rate1 = rates[0].querySelector('.cube-rate-item_active') - const rate2 = rates[1].querySelector('.cube-rate-item_half_active') + const rate1 = rates[0].querySelector('.cube-rate-item-def-active') + const rate2 = rates[1].querySelector('.cube-rate-item-def-half-active') const rate3 = rates[2].querySelector('.cube-rate-item-def') expect(component.instance.value).toBe(1.5) expect(justify).toBeUndefined() @@ -134,7 +134,7 @@ describe('component rate unit test', function () { it('should render correct contents: value/justify/allowHalf/disabled', () => { const justify = component.querySelector('rate').querySelector('.cube-rate-justify') const rateItems = component.querySelectorAll('rate-item') - const rateItems1 = rateItems[0].querySelector('.cube-rate-item_active') + const rateItems1 = rateItems[0].querySelector('.cube-rate-item-def-active') const rateItems2 = rateItems[1].querySelector('.cube-rate-item-def') expect(rateItems.length).toBe(4) diff --git a/packages/mpx-cube-ui/src/components/rate/rate-item-index.ts b/packages/mpx-cube-ui/src/components/rate/rate-item-index.ts index 75102e7..445e7ba 100644 --- a/packages/mpx-cube-ui/src/components/rate/rate-item-index.ts +++ b/packages/mpx-cube-ui/src/components/rate/rate-item-index.ts @@ -14,8 +14,8 @@ createComponent({ computed: { rateItemClass() { return { - 'cube-rate-item_active': this.index <= this.value, - 'cube-rate-item_half_active': this.index === this.value + 0.5 + 'cube-rate-item-def-active': this.index <= this.value, + 'cube-rate-item-def-half-active': this.index === this.value + 0.5 } } } diff --git a/packages/mpx-cube-ui/src/components/rate/rate-item.mpx b/packages/mpx-cube-ui/src/components/rate/rate-item.mpx index e132d48..b16057b 100644 --- a/packages/mpx-cube-ui/src/components/rate/rate-item.mpx +++ b/packages/mpx-cube-ui/src/components/rate/rate-item.mpx @@ -1,6 +1,6 @@