fix: lint error

pull/3131/head^2
tangjinzhou 2020-11-07 22:43:31 +08:00
parent b155627923
commit 19d5e7a14a
6 changed files with 41 additions and 45 deletions

View File

@ -67,8 +67,8 @@ if (process.env.NODE_ENV === 'test') {
inheritAttrs: false,
props: ['tag', 'class'],
setup(props, { slots }) {
const { tag: Tag, ...rest } = props;
return () => {
const { tag: Tag, ...rest } = props;
const children = slots.default?.() || [];
if (Tag) {
return <Tag {...rest}>{children}</Tag>;

View File

@ -250,22 +250,6 @@ export default defineComponent({
return promise;
},
getRules() {
let formRules = this.FormContext.rules;
const selfRules = this.rules;
const requiredRule =
this.required !== undefined
? { required: !!this.required, trigger: this.mergedValidateTrigger }
: [];
const prop = getPropByPath(formRules, this.namePath);
formRules = formRules ? prop.o[prop.k] || prop.v : [];
const rules = [].concat(selfRules || formRules || []);
if (find(rules, rule => rule.required)) {
return rules;
} else {
return rules.concat(requiredRule);
}
},
onFieldBlur() {
this.validateRules({ triggerName: 'blur' });
},

View File

@ -47,7 +47,7 @@ const ARow = defineComponent<RowProps>({
onMounted(() => {
token = ResponsiveObserve.subscribe(screen => {
const currentGutter = gutterRef.value || 0;
const currentGutter = props.gutter || 0;
if (
(!Array.isArray(currentGutter) && typeof currentGutter === 'object') ||
(Array.isArray(currentGutter) &&
@ -70,8 +70,6 @@ const ARow = defineComponent<RowProps>({
xl: true,
xxl: true,
});
const gutterRef = ref<Gutter | [Gutter, Gutter]>();
gutterRef.value = props.gutter;
const { getPrefixCls } = inject('configProvider', defaultConfigProvider);

View File

@ -1,4 +1,4 @@
import { watchEffect, reactive, defineComponent, nextTick } from 'vue';
import { reactive, defineComponent, nextTick, computed, watch } from 'vue';
import FilterFilled from '@ant-design/icons-vue/FilterFilled';
import Menu, { SubMenu, Item as MenuItem } from '../vc-menu';
import closest from 'dom-closest';
@ -27,32 +27,44 @@ export default defineComponent({
props: initDefaultProps(FilterMenuProps, {
column: {},
}),
setup(nextProps) {
let preProps = { ...nextProps };
const { selectedKeys, column } = nextProps;
setup(props) {
const sSelectedKeys = computed(() => props.selectedKeys);
const sVisible = computed(() => {
return 'filterDropdownVisible' in props.column ? props.column.filterDropdownVisible : false;
});
const sValueKeys = computed(() => generateValueMaps(props.column.filters));
const state = reactive({
neverShown: false,
sSelectedKeys: selectedKeys,
sSelectedKeys: sSelectedKeys.value,
sKeyPathOfSelectedItem: {}, // 记录所有有选中子菜单的祖先菜单
sVisible: 'filterDropdownVisible' in column ? column.filterDropdownVisible : false,
sValueKeys: generateValueMaps(column.filters),
sVisible: sVisible.value,
sValueKeys: sValueKeys.value,
});
watchEffect(
() => {
const { column } = nextProps;
if (!shallowequal(preProps.selectedKeys, nextProps.selectedKeys)) {
state.sSelectedKeys = nextProps.selectedKeys;
}
if (!shallowequal((preProps.column || {}).filters, (nextProps.column || {}).filters)) {
state.sValueKeys = generateValueMaps(nextProps.column.filters);
}
if ('filterDropdownVisible' in column) {
state.sVisible = column.filterDropdownVisible;
}
preProps = { ...nextProps };
},
{ flush: 'sync' },
);
watch(sSelectedKeys, () => {
state.sSelectedKeys = sSelectedKeys.value;
});
watch(sVisible, () => {
state.sVisible = sVisible.value;
});
watch(sValueKeys, () => {
state.sValueKeys = sValueKeys.value;
});
// watchEffect(
// () => {
// const { column } = nextProps;
// if (!shallowequal(preProps.selectedKeys, nextProps.selectedKeys)) {
// state.sSelectedKeys = nextProps.selectedKeys;
// }
// if (!shallowequal((preProps.column || {}).filters, (nextProps.column || {}).filters)) {
// state.sValueKeys = generateValueMaps(nextProps.column.filters);
// }
// if ('filterDropdownVisible' in column) {
// state.sVisible = column.filterDropdownVisible;
// }
// preProps = { ...nextProps };
// },
// { flush: 'sync' },
// );
return state;
},

View File

@ -455,7 +455,7 @@ export default function generateSelector<
// Display options for OptionList
const displayOptions = computed<OptionsType>(() => {
if (!mergedSearchValue.value || !mergedShowSearch) {
if (!mergedSearchValue.value || !mergedShowSearch.value) {
return [...mergedOptions.value] as OptionsType;
}
const { optionFilterProp = 'value', mode, filterOption } = props;
@ -969,7 +969,7 @@ export default function generateSelector<
() => {
if (triggerOpen.value) {
const newWidth = Math.ceil(containerRef.value.offsetWidth);
if (containerWidth !== newWidth) {
if (containerWidth.value !== newWidth) {
containerWidth.value = newWidth;
}
}

View File

@ -45,8 +45,10 @@ export default defineComponent({
setup(props) {
let activeKey;
if (props.activeKey !== undefined) {
// eslint-disable-next-line vue/no-setup-props-destructure
activeKey = props.activeKey;
} else if (props.defaultActiveKey !== undefined) {
// eslint-disable-next-line vue/no-setup-props-destructure
activeKey = props.defaultActiveKey;
} else {
activeKey = getDefaultActiveKey(props);