mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
perf: no longer need transform prefix (#9588)
* perf: no longer need transform prefix * chore: upd * chore: upd
This commit is contained in:
parent
ebffeb4cda
commit
e8186795b7
@ -15,9 +15,6 @@ function findRootDir(dir: string): string {
|
||||
return findRootDir(parentDir);
|
||||
}
|
||||
|
||||
// Colors
|
||||
export const GREEN = '#07c160';
|
||||
|
||||
// Root paths
|
||||
export const CWD = process.cwd();
|
||||
export const ROOT = findRootDir(CWD);
|
||||
@ -29,7 +26,6 @@ export const SITE_DIST_DIR = join(ROOT, 'site-dist');
|
||||
export const VANT_CONFIG_FILE = join(ROOT, 'vant.config.js');
|
||||
export const PACKAGE_JSON_FILE = join(ROOT, 'package.json');
|
||||
export const ROOT_POSTCSS_CONFIG_FILE = join(ROOT, 'postcss.config.js');
|
||||
export const CACHE_DIR = join(ROOT, 'node_modules/.cache');
|
||||
|
||||
// Relative paths
|
||||
export const DIST_DIR = join(__dirname, '../../dist');
|
||||
@ -47,7 +43,6 @@ export const SITE_DESKTOP_SHARED_FILE = join(
|
||||
export const STYLE_DEPS_JSON_FILE = join(DIST_DIR, 'style-deps.json');
|
||||
|
||||
// Config files
|
||||
export const BABEL_CONFIG_FILE = join(CONFIG_DIR, 'babel.config.js');
|
||||
export const POSTCSS_CONFIG_FILE = join(CONFIG_DIR, 'postcss.config.js');
|
||||
export const JEST_SETUP_FILE = join(CONFIG_DIR, 'jest.setup.js');
|
||||
export const JEST_CONFIG_FILE = join(CONFIG_DIR, 'jest.config.js');
|
||||
|
@ -415,8 +415,7 @@ export default defineComponent({
|
||||
);
|
||||
|
||||
if (disabledDay) {
|
||||
const lastAbledEndDay = getPrevDay(disabledDay);
|
||||
select([startDay, lastAbledEndDay]);
|
||||
select([startDay, getPrevDay(disabledDay)]);
|
||||
} else {
|
||||
select([startDay, date], true);
|
||||
}
|
||||
@ -528,9 +527,9 @@ export default defineComponent({
|
||||
showTitle={props.showTitle}
|
||||
showSubtitle={props.showSubtitle}
|
||||
firstDayOfWeek={dayOffset.value}
|
||||
onClick-subtitle={(event: MouseEvent) => {
|
||||
emit('click-subtitle', event);
|
||||
}}
|
||||
onClick-subtitle={(event: MouseEvent) =>
|
||||
emit('click-subtitle', event)
|
||||
}
|
||||
/>
|
||||
<div ref={bodyRef} class={bem('body')} onScroll={onScroll}>
|
||||
{months.value.map(renderMonth)}
|
||||
@ -542,9 +541,7 @@ export default defineComponent({
|
||||
watch(() => props.show, init);
|
||||
watch(
|
||||
() => [props.type, props.minDate, props.maxDate],
|
||||
() => {
|
||||
reset(getInitialDate(currentDate.value));
|
||||
}
|
||||
() => reset(getInitialDate(currentDate.value))
|
||||
);
|
||||
watch(
|
||||
() => props.defaultDate,
|
||||
|
@ -24,7 +24,7 @@ export type CascaderOption = {
|
||||
|
||||
type CascaderTab = {
|
||||
options: CascaderOption[];
|
||||
selectedOption: CascaderOption | null;
|
||||
selected: CascaderOption | null;
|
||||
};
|
||||
|
||||
export type CascaderFieldNames = {
|
||||
@ -111,7 +111,7 @@ export default defineComponent({
|
||||
state.tabs = selectedOptions.map((option) => {
|
||||
const tab = {
|
||||
options: optionsCursor,
|
||||
selectedOption: option,
|
||||
selected: option,
|
||||
};
|
||||
|
||||
const next = optionsCursor.find(
|
||||
@ -127,7 +127,7 @@ export default defineComponent({
|
||||
if (optionsCursor) {
|
||||
state.tabs.push({
|
||||
options: optionsCursor,
|
||||
selectedOption: null,
|
||||
selected: null,
|
||||
});
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ export default defineComponent({
|
||||
state.tabs = [
|
||||
{
|
||||
options: props.options,
|
||||
selectedOption: null,
|
||||
selected: null,
|
||||
},
|
||||
];
|
||||
};
|
||||
@ -152,7 +152,7 @@ export default defineComponent({
|
||||
return;
|
||||
}
|
||||
|
||||
state.tabs[tabIndex].selectedOption = option;
|
||||
state.tabs[tabIndex].selected = option;
|
||||
|
||||
if (state.tabs.length > tabIndex + 1) {
|
||||
state.tabs = state.tabs.slice(0, tabIndex + 1);
|
||||
@ -161,7 +161,7 @@ export default defineComponent({
|
||||
if (option[childrenKey]) {
|
||||
const nextTab = {
|
||||
options: option[childrenKey],
|
||||
selectedOption: null,
|
||||
selected: null,
|
||||
};
|
||||
|
||||
if (state.tabs[tabIndex + 1]) {
|
||||
@ -176,7 +176,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const selectedOptions = state.tabs
|
||||
.map((tab) => tab.selectedOption)
|
||||
.map((tab) => tab.selected)
|
||||
.filter(Boolean);
|
||||
|
||||
const eventParams = {
|
||||
@ -260,19 +260,19 @@ export default defineComponent({
|
||||
);
|
||||
|
||||
const renderTab = (tab: CascaderTab, tabIndex: number) => {
|
||||
const { options, selectedOption } = tab;
|
||||
const title = selectedOption
|
||||
? selectedOption[textKey]
|
||||
const { options, selected } = tab;
|
||||
const title = selected
|
||||
? selected[textKey]
|
||||
: props.placeholder || t('select');
|
||||
|
||||
return (
|
||||
<Tab
|
||||
title={title}
|
||||
titleClass={bem('tab', {
|
||||
unselected: !selectedOption,
|
||||
unselected: !selected,
|
||||
})}
|
||||
>
|
||||
{renderOptions(options, selectedOption, tabIndex)}
|
||||
{renderOptions(options, selected, tabIndex)}
|
||||
</Tab>
|
||||
);
|
||||
};
|
||||
@ -298,9 +298,7 @@ export default defineComponent({
|
||||
() => props.modelValue,
|
||||
(value) => {
|
||||
if (value || value === 0) {
|
||||
const values = state.tabs.map(
|
||||
(tab) => tab.selectedOption?.[valueKey]
|
||||
);
|
||||
const values = state.tabs.map((tab) => tab.selected?.[valueKey]);
|
||||
if (values.includes(value)) {
|
||||
return;
|
||||
}
|
||||
|
@ -29,10 +29,8 @@ const MOMENTUM_LIMIT_DISTANCE = 15;
|
||||
const [name, bem] = createNamespace('picker-column');
|
||||
|
||||
function getElementTranslateY(element: Element) {
|
||||
const style = window.getComputedStyle(element);
|
||||
const transform = style.transform || style.webkitTransform;
|
||||
const { transform } = window.getComputedStyle(element);
|
||||
const translateY = transform.slice(7, transform.length - 1).split(', ')[5];
|
||||
|
||||
return Number(translateY);
|
||||
}
|
||||
|
||||
@ -316,36 +314,30 @@ export default defineComponent({
|
||||
|
||||
watch(
|
||||
() => props.defaultIndex,
|
||||
(value) => {
|
||||
setIndex(value);
|
||||
}
|
||||
(value) => setIndex(value)
|
||||
);
|
||||
|
||||
return () => {
|
||||
const wrapperStyle = {
|
||||
transform: `translate3d(0, ${state.offset + baseOffset()}px, 0)`,
|
||||
transitionDuration: `${state.duration}ms`,
|
||||
transitionProperty: state.duration ? 'all' : 'none',
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
class={[bem(), props.className]}
|
||||
onTouchstart={onTouchStart}
|
||||
onTouchmove={onTouchMove}
|
||||
onTouchend={onTouchEnd}
|
||||
onTouchcancel={onTouchEnd}
|
||||
return () => (
|
||||
<div
|
||||
class={[bem(), props.className]}
|
||||
onTouchstart={onTouchStart}
|
||||
onTouchmove={onTouchMove}
|
||||
onTouchend={onTouchEnd}
|
||||
onTouchcancel={onTouchEnd}
|
||||
>
|
||||
<ul
|
||||
ref={wrapper}
|
||||
style={{
|
||||
transform: `translate3d(0, ${state.offset + baseOffset()}px, 0)`,
|
||||
transitionDuration: `${state.duration}ms`,
|
||||
transitionProperty: state.duration ? 'all' : 'none',
|
||||
}}
|
||||
class={bem('wrapper')}
|
||||
onTransitionend={stopMomentum}
|
||||
>
|
||||
<ul
|
||||
ref={wrapper}
|
||||
style={wrapperStyle}
|
||||
class={bem('wrapper')}
|
||||
onTransitionend={stopMomentum}
|
||||
>
|
||||
{renderOptions()}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
{renderOptions()}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user