From 09417cb0ff5890cce73480f89d83392b3c21e45c Mon Sep 17 00:00:00 2001
From: anlyyao
Date: Fri, 16 Jun 2023 15:47:48 +0800
Subject: [PATCH 1/2] feat(Rate): add disabled style
---
.../__test__/__snapshots__/demo.test.jsx.snap | 4 ----
src/rate/demos/mobile.vue | 8 ++++----
src/rate/rate.vue | 20 ++++++++++---------
3 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/src/rate/__test__/__snapshots__/demo.test.jsx.snap b/src/rate/__test__/__snapshots__/demo.test.jsx.snap
index 962034fc8..210d8e4b6 100644
--- a/src/rate/__test__/__snapshots__/demo.test.jsx.snap
+++ b/src/rate/__test__/__snapshots__/demo.test.jsx.snap
@@ -1103,7 +1103,6 @@ exports[`Rate > Rate mobileVue demo works fine 1`] = `
>
用于对某行为/事物进行打分。
-
@@ -1878,7 +1877,6 @@ exports[`Rate > Rate mobileVue demo works fine 1`] = `
-
@@ -2236,7 +2234,6 @@ exports[`Rate > Rate mobileVue demo works fine 1`] = `
-
@@ -2931,7 +2928,6 @@ exports[`Rate > Rate mobileVue demo works fine 1`] = `
-
diff --git a/src/rate/demos/mobile.vue b/src/rate/demos/mobile.vue
index 36b51bf47..9f85fb93c 100644
--- a/src/rate/demos/mobile.vue
+++ b/src/rate/demos/mobile.vue
@@ -2,7 +2,7 @@
Rate 评分
用于对某行为/事物进行打分。
-
+
@@ -15,18 +15,18 @@
-
+
-
+
-
+
diff --git a/src/rate/rate.vue b/src/rate/rate.vue
index 62d617d47..f66d48db6 100644
--- a/src/rate/rate.vue
+++ b/src/rate/rate.vue
@@ -1,5 +1,5 @@
-
+
(null);
const [actualVal] = useDefault
(props, context.emit, 'value', 'change');
const rateText = computed(() => {
@@ -172,9 +175,10 @@ export default defineComponent({
);
};
+ const rootClasses = computed(() => [`${name}`, { [`${name}--disabled`]: disabled.value }]);
+
const classes = (n: number) => {
const classPrefix = `${name}__icon`;
- const { disabled } = props;
const className = {
[classPrefix]: true,
};
@@ -183,9 +187,6 @@ export default defineComponent({
}
if (actualVal.value >= n) {
className[`${classPrefix}--selected`] = true;
- if (disabled) {
- className[`${classPrefix}--disabled`] = true;
- }
} else {
className[`${classPrefix}--unselected`] = true;
}
@@ -225,7 +226,7 @@ export default defineComponent({
};
const onClick = (event: MouseEvent) => {
- if (props.disabled) return;
+ if (disabled.value) return;
// if (Date.now() - touchStartTime.value > 200) return;
getRect(event, 'tap');
};
@@ -236,19 +237,19 @@ export default defineComponent({
};
const onTouchstart = (e: TouchEvent) => {
- if (props.disabled) return;
+ if (disabled.value) return;
touchStartTime.value = Date.now();
touchEnd.value = false;
};
const onTouchmove = (e: TouchEvent) => {
- if (props.disabled) return;
+ if (disabled.value) return;
if (Date.now() - touchStartTime.value <= 200) return;
onTouch(e, 'move');
};
const onTouchEnd = (e: TouchEvent) => {
- if (props.disabled) return;
+ if (disabled.value) return;
touchEnd.value = true;
hideTips();
};
@@ -296,6 +297,7 @@ export default defineComponent({
return {
name: ref(name),
+ rootClasses,
classes,
rateWrapper,
actualVal,
From 413788572364e15db96a61fe63394e0536134923 Mon Sep 17 00:00:00 2001
From: anlyyao
Date: Fri, 16 Jun 2023 15:48:27 +0800
Subject: [PATCH 2/2] fix(Table): update demo
---
.../__test__/__snapshots__/demo.test.jsx.snap | 238 ++++++++++++------
src/form/demos/horizontal.vue | 27 +-
src/form/demos/mobile.vue | 6 +-
src/form/demos/vertical.vue | 17 +-
4 files changed, 193 insertions(+), 95 deletions(-)
diff --git a/src/form/__test__/__snapshots__/demo.test.jsx.snap b/src/form/__test__/__snapshots__/demo.test.jsx.snap
index 7bd0e971b..c0ea42c8e 100644
--- a/src/form/__test__/__snapshots__/demo.test.jsx.snap
+++ b/src/form/__test__/__snapshots__/demo.test.jsx.snap
@@ -32,7 +32,7 @@ exports[`Form > Form horizontalVue demo works fine 1`] = `
>