|
@@ -20,19 +20,37 @@ const _sfc_main = {
|
|
|
const moveX = common_vendor.ref(0);
|
|
const moveX = common_vendor.ref(0);
|
|
|
let currentX = 0;
|
|
let currentX = 0;
|
|
|
let autoResetTimer = null;
|
|
let autoResetTimer = null;
|
|
|
|
|
+ let checkTimer = null;
|
|
|
const AUTO_RESET_DELAY = 2e3;
|
|
const AUTO_RESET_DELAY = 2e3;
|
|
|
|
|
+ let lastSlideTime = 0;
|
|
|
const startAutoResetTimer = () => {
|
|
const startAutoResetTimer = () => {
|
|
|
|
|
+ lastSlideTime = Date.now();
|
|
|
clearAutoResetTimer();
|
|
clearAutoResetTimer();
|
|
|
autoResetTimer = setTimeout(() => {
|
|
autoResetTimer = setTimeout(() => {
|
|
|
- moveX.value = 0;
|
|
|
|
|
- currentX = 0;
|
|
|
|
|
|
|
+ if (moveX.value < 0) {
|
|
|
|
|
+ moveX.value = 0;
|
|
|
|
|
+ currentX = 0;
|
|
|
|
|
+ }
|
|
|
}, AUTO_RESET_DELAY);
|
|
}, AUTO_RESET_DELAY);
|
|
|
|
|
+ if (!checkTimer) {
|
|
|
|
|
+ checkTimer = setInterval(() => {
|
|
|
|
|
+ if (moveX.value < 0 && Date.now() - lastSlideTime > AUTO_RESET_DELAY) {
|
|
|
|
|
+ moveX.value = 0;
|
|
|
|
|
+ currentX = 0;
|
|
|
|
|
+ clearAutoResetTimer();
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
const clearAutoResetTimer = () => {
|
|
const clearAutoResetTimer = () => {
|
|
|
if (autoResetTimer) {
|
|
if (autoResetTimer) {
|
|
|
clearTimeout(autoResetTimer);
|
|
clearTimeout(autoResetTimer);
|
|
|
autoResetTimer = null;
|
|
autoResetTimer = null;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (checkTimer) {
|
|
|
|
|
+ clearInterval(checkTimer);
|
|
|
|
|
+ checkTimer = null;
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
const canvasId = common_vendor.ref(`chart-${props.stock.code}-${Math.random().toString(36).slice(2, 11)}`);
|
|
const canvasId = common_vendor.ref(`chart-${props.stock.code}-${Math.random().toString(36).slice(2, 11)}`);
|
|
|
const getMarketTag = (code) => {
|
|
const getMarketTag = (code) => {
|
|
@@ -153,6 +171,7 @@ const _sfc_main = {
|
|
|
const handleMoveChange = (e) => {
|
|
const handleMoveChange = (e) => {
|
|
|
currentX = e.detail.x;
|
|
currentX = e.detail.x;
|
|
|
if (props.showDelete && currentX <= -deleteWidth / 2) {
|
|
if (props.showDelete && currentX <= -deleteWidth / 2) {
|
|
|
|
|
+ lastSlideTime = Date.now();
|
|
|
startAutoResetTimer();
|
|
startAutoResetTimer();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|