diff --git a/src/rate/__test__/__snapshots__/demo.test.jsx.snap b/src/rate/__test__/__snapshots__/demo.test.jsx.snap index 73dc10158..8d46a5ef0 100644 --- a/src/rate/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/rate/__test__/__snapshots__/demo.test.jsx.snap @@ -1,50 +1,39 @@ // Vitest Snapshot v1 -exports[`Rate > Rate allowHalfVue demo works fine 1`] = ` +exports[`Rate > Rate actionVue demo works fine 1`] = `
-
- 半星评价 -
+

+ 只可选全星时 +

-
+
+

+ 可选半星时 +

+
+
+ 点击或滑动 +
+
+
- - - - - - - - - - - - - - - - + + + +
Rate allowHalfVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - - -
  • - +
    - - - - - - - - - + + + +
    Rate allowHalfVue demo works fine 1`] = ` fill-opacity="0.9" /> - -
    - +
    - - - - - - - -
  • -
  • - - + + + +
  • Rate allowHalfVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - - +
    - +
    + + + +
    @@ -316,17 +297,33 @@ exports[`Rate > Rate allowHalfVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - +
    - +
    + + + +
    @@ -336,15 +333,136 @@ exports[`Rate > Rate allowHalfVue demo works fine 1`] = ` fill-opacity="0.9" /> - - +
    - +
    + + +
    + + + +`; + +exports[`Rate > Rate baseVue demo works fine 1`] = ` +
    +
    + 实心评分 +
    +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    - +
    +
    -
    `; @@ -354,56 +472,71 @@ exports[`Rate > Rate colorVue demo works fine 1`] = ` >
    - 空心评分 + 填充评分
    -
    -
    +
    +
    + @@ -413,42 +546,69 @@ exports[`Rate > Rate colorVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - -
  • + + + +
  • +
    - - - - - + + + +
    +
    +
    - @@ -458,67 +618,129 @@ exports[`Rate > Rate colorVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - -
  • + + + +
  • +
    - - - - - + + + +
    + +
    + + +
    +
    +
    +
    + 线描评分 +
    +
    +
    + +
    +
    - - - - -
  • + + + +
  • +
    - - @@ -528,42 +750,69 @@ exports[`Rate > Rate colorVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - + + + +
    +
    +
    - - - - -
  • + + + +
  • +
    - - @@ -573,6533 +822,3001 @@ exports[`Rate > Rate colorVue demo works fine 1`] = ` fill-opacity="0.9" /> - - - + + + +
    +
    +
    - - - - +
    + + + +
    - +
    +
    - +
    + +
    +`; + +exports[`Rate > Rate countVue demo works fine 1`] = ` +
    +
    + 自定义评分数量
    - 实心评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - -
    -`; - -exports[`Rate > Rate countVue demo works fine 1`] = ` -
    -
    - 自定义数量 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    -`; - -exports[`Rate > Rate disabledVue demo works fine 1`] = ` -
    -
    - 仅展示 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    -`; - -exports[`Rate > Rate filledVue demo works fine 1`] = ` -
    -
    - 请点击评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    -`; - -exports[`Rate > Rate iconVue demo works fine 1`] = ` -
    -
    - 规格20 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    -`; - -exports[`Rate > Rate mobileVue demo works fine 1`] = ` -
    -

    - Rate 评分 -

    -

    - 用于对某行为/事物进行打分。 -

    -
    -
    -

    - 01 类型 -

    -

    - 实心评分 -

    -
    -
    - -
    -
    - 请点击评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - -
    -
    -
    -
    - -

    - 空心评分 -

    -
    -
    - -
    -
    - 请点击评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - -
    -
    -
    -
    - -

    - 自定义数量评分 -

    -
    -
    - -
    -
    - 自定义数量 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - -
    -
    -
    -
    - -

    - 半星评分 -

    -
    -
    - -
    -
    - 半星评价 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - -
    -
    -
    -
    - -

    - 带描述评分 -

    -
    -
    - - -
    -
    - 请点击评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - - 3 分 - -
    - -
    -
    -
    - 请点击评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - - 一般 - -
    - -
    -
    -
    - 请点击评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - - 一般 - -
    - -
    - - -
    -
    -
    -
    - -

    - 禁用评分 -

    -
    -
    - -
    -
    - 仅展示 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - -
    -
    -
    -
    - -

    - 设置评分颜色 -

    -
    -
    - - -
    -
    - 空心评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    -
    -
    - 实心评分 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • - -
    - -
    - -
    - - -
    -
    -
    -
    -

    - 02 规格 -

    -

    - 评价规格 -

    -
    -
    - - -
    -
    - 规格20 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - + + +
    -
    - 规格16 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • - -
    - -
    - + + + +
    +
    + + +
    -
    + +
    +
    +`; + +exports[`Rate > Rate customVue demo works fine 1`] = ` +
    + 自定义评分 +
    +
    - -

    - 自定义图标评分 -

    -
    -
    -
    - 规格20 -
    - -
    -
      - -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - - - - - - - - - - -
    • - -
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
    +`; + +exports[`Rate > Rate mobileVue demo works fine 1`] = ` +
    +

    + Rate 评分 +

    +

    + 用于对某行为/事物进行打分。 +

    +
    +
    +
    +

    + 01 组件类型 +

    +

    + 实心评分 +

    +
    +
    + +
    +
    + 实心评分 +
    +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    +
    -
    -
    -`; - -exports[`Rate > Rate outlineVue demo works fine 1`] = ` -
    -
    - 请点击评分 -
    -
    -
      + +

      + 自定义评分 +

      +
    +
    -
  • - - - - - - - - - - - - - - -
  • -
  • +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
  • + +
    +
    +
    +
    + +

    - - - - - - - - - - - - - - - -

  • +
  • +
    + +
    - - - - - - - - - - - - - - - -
  • +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
  • + +
    +
    +
    +
    + +

    - - - - - - - - - - - - - - - -

  • +
  • +
    + + +
    - - - - - - - - - - +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + - - - - - + 一般 + + +
    +
    +
    +
    + 带描述评分 +
    +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + 5 分 + + +
    +
    +
    +
    + 带描述评分 +
    +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
    - - + +
    - -
    -`; - -exports[`Rate > Rate sizeVue demo works fine 1`] = ` -
    - +
    - 规格20 +

    + 02 组件状态 +

    +
    -
    -
      - -
    • - - - - - - - - - - - - - - -
    • -
    • +
      +
      - - - - - - - - - - - - - - -
    • -
    • +
      +
      + +
      + + + +
      +
      + + + +
      +
      + + + +
      +
      + + + +
      +
      + + + +
      + +
      + + +
      +
    +

    + 可选半星时 +

    +
    +
    - - - - - - - - - - - - - - - -
  • +
    - - - - - - - - - + + + +
    + + + +
  • +
    - - - - - -
  • - - - + + + +
  • + + + +
    +
    - - - - - - - + + + +
    + + + +
    +
    - - +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    - - - - - +
    + + + + + + - +
    - 规格16 +

    + 03 组件样式 +

    +

    + 评分大小 +

    -
    -
    + + +
    + +
    +
    - - - - - - - - - - - - - - - -
  • +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
  • + + +
    + +
    +
    + +

    + 设置评分颜色 +

    +
    +
    + + +
    +
    - +
    +
    - - - - - - - - + + + +
    + + + +
    +
    - - +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    -
    - -
  • + + +
  • +
    +
    +
    - +
    +
    - - - - - - - - + + + +
    + + + +
    +
    - - +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    +
    +
    + + + +
    + + + +
    -
    - - - - +
    + + +
    +
    + + +
    + +
    +
    +
    +

    + 04 特殊样式 +

    +

    + 竖向带描述评分 +

    +
    +
    + +
    +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
    + 可以前往 +
    +
    +
    -
    - `; -exports[`Rate > Rate textVue demo works fine 1`] = ` +exports[`Rate > Rate showTextVue demo works fine 1`] = `
    - 请点击评分 + 带描述评分
    -
    -
      -
    • - - - - - - - - - - - - - - -
    • -
    • - - - - - - - - - - - - - - -
    • -
    • + +
    +
    - - - - - - - - - - - - - - - -
  • + +
  • +
    - - - - - - - - - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    +
    + - - - - - - - + + +
    - +
    - 3 分 + 一般 +
    -
    - 请点击评分 + 带描述评分
    -
    -
    +
    + - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    +
    + - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    + +
    + + 5 分 + + + + +
    +
    + 带描述评分 +
    +
    +
    + +
    + - - - - - - - -
  • + +
  • +
    + + + +
    +
    - - - - - - - - - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    +
    + - - - - - - - + + +
    - +
    - 一般 - + class="t-rate__text" + /> +
    -
    + + +`; + +exports[`Rate > Rate sizeVue demo works fine 1`] = ` +
    +
    - 请点击评分 + 大尺寸 24
    -
    -
      -
    • - - - - - - - - + +
    +
    + - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    +
    + - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    + +
    + + +
    + +
    +
    + 小尺寸 20 +
    +
    +
    + +
    + - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    +
    + - - - - - - - -
  • + +
  • +
    - - - - - - - - + +
    +
    + - - - - - - - + + +
    - - - 一般 - +
    + +
    -
    `; + +exports[`Rate > Rate specialVue demo works fine 1`] = ` +
    +
    +
    + +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + +
    + + +
    +
    + 可以前往 +
    +
    +`; diff --git a/src/rate/__test__/demo.test.jsx b/src/rate/__test__/demo.test.jsx index 5053c0ce7..1b91945f2 100644 --- a/src/rate/__test__/demo.test.jsx +++ b/src/rate/__test__/demo.test.jsx @@ -3,28 +3,26 @@ */ import { mount } from '@vue/test-utils'; -import allowHalfVue from '@/rate/demos/allow-half.vue'; +import actionVue from '@/rate/demos/action.vue'; +import baseVue from '@/rate/demos/base.vue'; import colorVue from '@/rate/demos/color.vue'; import countVue from '@/rate/demos/count.vue'; -import disabledVue from '@/rate/demos/disabled.vue'; -import filledVue from '@/rate/demos/filled.vue'; -import iconVue from '@/rate/demos/icon.vue'; +import customVue from '@/rate/demos/custom.vue'; import mobileVue from '@/rate/demos/mobile.vue'; -import outlineVue from '@/rate/demos/outline.vue'; +import showTextVue from '@/rate/demos/show-text.vue'; import sizeVue from '@/rate/demos/size.vue'; -import textVue from '@/rate/demos/text.vue'; +import specialVue from '@/rate/demos/special.vue'; const mapper = { - allowHalfVue, + actionVue, + baseVue, colorVue, countVue, - disabledVue, - filledVue, - iconVue, + customVue, mobileVue, - outlineVue, + showTextVue, sizeVue, - textVue, + specialVue, }; describe('Rate', () => { diff --git a/src/rate/__test__/index.test.jsx b/src/rate/__test__/index.test.jsx index 810901c59..66aded861 100644 --- a/src/rate/__test__/index.test.jsx +++ b/src/rate/__test__/index.test.jsx @@ -18,63 +18,54 @@ describe('Rate', () => { describe('Rate', () => { it('create', async () => { const wrapper = mount(() => ); - expect(wrapper.classes()).toContain('t-rate'); - const items = wrapper.findAll('.t-rate--item'); + expect(wrapper.classes()).toContain(`${name}`); + const items = wrapper.findAll(`.${name}__icon`); expect(items.length).toBe(5); - const icon = wrapper.findComponent(StarFilledIcon); + const icon = wrapper.findComponent(StarIcon); expect(icon.exists()).toBeTruthy(); }); it(': count', async () => { const wrapper = mount(() => ); - const items = wrapper.findAll('.t-rate--item'); + const items = wrapper.findAll(`.${name}__icon`); expect(items.length).toBe(10); }); it(': gap', async () => { const wrapper = mount(() => ); - const items = wrapper.findAll('.t-rate--item'); + const items = wrapper.findAll(`.${name}__icon`); for (let i = 0; i < items.length - 1; i++) { expect(getComputedStyle(items[i].element, null).marginRight).toBe('10px'); } expect(getComputedStyle(items[items.length - 1].element, null).marginRight).toBe('0px'); }); - it(': variant', async () => { - const wrapper = mount(() => ); - const icon = wrapper.findComponent(StarIcon); - expect(icon.exists()).toBeTruthy(); - }); - it(': allowHalf', async () => { const value = ref(0); const showText = true; const texts = ['很差', '差', '一般', '好评', '优秀']; const onChange = vi.fn(); const wrapper = mount(() => ); - const leftIcons = wrapper.findAll('.t-rate--icon-left'); - const rightIcons = wrapper.findAll('.t-rate--icon-right'); - await leftIcons[0].trigger('click'); + const icons = wrapper.findAll(`.${name}__icon`); + await icons[0].trigger('click'); + let tips = wrapper.find(`.${name}__tips`) + expect(tips.exists()).toBeTruthy(); + let tipsItem = tips.findAll(`.${name}__tips-item`); + await tipsItem[0].trigger('click'); expect(onChange).toHaveBeenCalledTimes(1); - expect(leftIcons[0].exists()).toBeTruthy(); + expect(icons[0].exists()).toBeTruthy(); expect(value.value).toBe(0.5); - await rightIcons[0].trigger('click'); + await icons[0].trigger('click'); + tips = wrapper.find(`.${name}__tips`) + expect(tips.exists()).toBeTruthy(); + tipsItem = tips.findAll(`.${name}__tips-item`); + await tipsItem[1].trigger('click'); expect(onChange).toHaveBeenCalledTimes(2); - expect(rightIcons[0].exists()).toBeTruthy(); + expect(icons[0].exists()).toBeTruthy(); expect(value.value).toBe(1); - const $target = wrapper.find(`.${name}--list`); + const $target = wrapper.find(`.${name}__wrapper`); await move($target); - expect(onChange).toHaveBeenCalledTimes(3); - }); - - it(': clearable', async () => { - const value = ref(1); - const wrapper = mount(() => ); - const icons = wrapper.findAll('.t-rate--icon'); - await icons[1].trigger('click'); - expect(value.value).toBe(2); - await icons[1].trigger('click'); - expect(value.value).toBe(0); + expect(onChange).toHaveBeenCalledTimes(2); }); it(': showText && texts', async () => { @@ -90,10 +81,10 @@ describe('Rate', () => { onChange, }, }); - const $text = wrapper.find(`.${name}--text`); + const $text = wrapper.find(`.${name}__text`); expect($text.text()).toEqual(texts[defaultValue - 1]); - const icons = wrapper.findAll(`.${name}--icon`); + const icons = wrapper.findAll(`.${name}__icon`); const index = 3; await icons[index].trigger('click'); expect(onChange).toHaveBeenLastCalledWith(index + 1); @@ -108,8 +99,8 @@ describe('Rate', () => { }, }); // disabled = true, 不触发 change, touch 无效 - const $target = wrapper.find(`.${name}--list`); - const icons = wrapper.findAll(`.${name}--icon`); + const $target = wrapper.find(`.${name}__wrapper`); + const icons = wrapper.findAll(`.${name}__icon`); const index = 3; await icons[index].trigger('click'); @@ -126,7 +117,7 @@ describe('Rate', () => { expect(onChange).toHaveBeenCalledTimes(1); expect(onChange).toHaveBeenLastCalledWith(index + 1); await move($target); - expect(onChange).toHaveBeenCalledTimes(2); + expect(onChange).toHaveBeenCalledTimes(1); }); }); }); diff --git a/src/rate/demos/action.vue b/src/rate/demos/action.vue new file mode 100644 index 000000000..9beb6bc06 --- /dev/null +++ b/src/rate/demos/action.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/rate/demos/allow-half.vue b/src/rate/demos/allow-half.vue deleted file mode 100644 index bc6b787b9..000000000 --- a/src/rate/demos/allow-half.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/src/rate/demos/base.vue b/src/rate/demos/base.vue new file mode 100644 index 000000000..7922049c8 --- /dev/null +++ b/src/rate/demos/base.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/rate/demos/color.vue b/src/rate/demos/color.vue index 4b2343c92..ead90fabd 100644 --- a/src/rate/demos/color.vue +++ b/src/rate/demos/color.vue @@ -1,22 +1,37 @@ + diff --git a/src/rate/demos/components/custom-cell.vue b/src/rate/demos/components/custom-cell.vue deleted file mode 100644 index ffcdd9b17..000000000 --- a/src/rate/demos/components/custom-cell.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/src/rate/demos/count.vue b/src/rate/demos/count.vue index 20aa708d4..1ca222712 100644 --- a/src/rate/demos/count.vue +++ b/src/rate/demos/count.vue @@ -1,13 +1,28 @@ + + diff --git a/src/rate/demos/custom.vue b/src/rate/demos/custom.vue new file mode 100644 index 000000000..99c35f754 --- /dev/null +++ b/src/rate/demos/custom.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/src/rate/demos/disabled.vue b/src/rate/demos/disabled.vue deleted file mode 100644 index 21bc1ab8c..000000000 --- a/src/rate/demos/disabled.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/src/rate/demos/filled.vue b/src/rate/demos/filled.vue deleted file mode 100644 index e7d0eefff..000000000 --- a/src/rate/demos/filled.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/rate/demos/icon.vue b/src/rate/demos/icon.vue deleted file mode 100644 index 89f3706b7..000000000 --- a/src/rate/demos/icon.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/src/rate/demos/mobile.vue b/src/rate/demos/mobile.vue index cff549b3b..36b51bf47 100644 --- a/src/rate/demos/mobile.vue +++ b/src/rate/demos/mobile.vue @@ -2,63 +2,44 @@

    Rate 评分

    用于对某行为/事物进行打分。

    - - +
    + + - - + + - + - - - - + + +
    + + - - +
    + + - - - - - +
    + +
    - - diff --git a/src/rate/demos/outline.vue b/src/rate/demos/outline.vue deleted file mode 100644 index ed5f86d1f..000000000 --- a/src/rate/demos/outline.vue +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/src/rate/demos/show-text.vue b/src/rate/demos/show-text.vue new file mode 100644 index 000000000..999357534 --- /dev/null +++ b/src/rate/demos/show-text.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/rate/demos/size.vue b/src/rate/demos/size.vue index dbef48324..6e4d83883 100644 --- a/src/rate/demos/size.vue +++ b/src/rate/demos/size.vue @@ -1,22 +1,37 @@ + diff --git a/src/rate/demos/special.vue b/src/rate/demos/special.vue new file mode 100644 index 000000000..094ea005f --- /dev/null +++ b/src/rate/demos/special.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/rate/demos/text.vue b/src/rate/demos/text.vue deleted file mode 100644 index 1aec81eff..000000000 --- a/src/rate/demos/text.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/src/rate/props.ts b/src/rate/props.ts index 0233831b6..8700a7c5f 100644 --- a/src/rate/props.ts +++ b/src/rate/props.ts @@ -31,7 +31,7 @@ export default { }, /** 自定义评分图标,[选中图标,未选中图标] */ icon: { - type: [Array, Function] as PropType, + type: [Function, Array] as PropType, }, /** 是否显示对应的辅助文字 */ showText: Boolean, diff --git a/src/rate/rate.vue b/src/rate/rate.vue index 344a99e66..610e92218 100644 --- a/src/rate/rate.vue +++ b/src/rate/rate.vue @@ -1,38 +1,84 @@