feat: add popup ref
parent
0d67fc1966
commit
f9373e44ce
|
@ -55,7 +55,15 @@ const AutoComplete = {
|
|||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
getInputElement() {
|
||||
const { $slots } = this;
|
||||
const children = filterEmpty($slots.default);
|
||||
|
|
|
@ -141,6 +141,11 @@ const Cascader = {
|
|||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
inject: {
|
||||
configProvider: { default: () => ({}) },
|
||||
localeData: { default: () => ({}) },
|
||||
|
@ -177,6 +182,9 @@ const Cascader = {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
highlightKeyword(str, keyword, prefixCls) {
|
||||
return str
|
||||
.split(keyword)
|
||||
|
|
|
@ -37,7 +37,11 @@ export default function wrapPicker(Picker, props, defaultFormat) {
|
|||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
const { autoFocus, disabled } = this;
|
||||
if (autoFocus && !disabled) {
|
||||
|
@ -47,6 +51,9 @@ export default function wrapPicker(Picker, props, defaultFormat) {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
handleOpenChange(open) {
|
||||
this.$emit('openChange', open);
|
||||
},
|
||||
|
|
|
@ -25,7 +25,18 @@ export default {
|
|||
event: 'visibleChange',
|
||||
},
|
||||
props: DropdownButtonProps,
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
inject: {
|
||||
configProvider: { default: () => ({}) },
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
onClick(e) {
|
||||
this.$emit('click', e);
|
||||
},
|
||||
|
@ -33,9 +44,6 @@ export default {
|
|||
this.$emit('visibleChange', val);
|
||||
},
|
||||
},
|
||||
inject: {
|
||||
configProvider: { default: () => ({}) },
|
||||
},
|
||||
render() {
|
||||
const {
|
||||
type,
|
||||
|
|
|
@ -20,10 +20,18 @@ const Dropdown = {
|
|||
prop: 'visible',
|
||||
event: 'visibleChange',
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
inject: {
|
||||
configProvider: { default: () => ({}) },
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
getTransitionName() {
|
||||
const { placement = '', transitionName } = this.$props;
|
||||
if (transitionName !== undefined) {
|
||||
|
|
|
@ -106,6 +106,11 @@ const Select = {
|
|||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
inject: {
|
||||
configProvider: { default: () => ({}) },
|
||||
},
|
||||
|
@ -118,6 +123,9 @@ const Select = {
|
|||
);
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
focus() {
|
||||
this.$refs.vcSelect.focus();
|
||||
},
|
||||
|
|
|
@ -86,6 +86,11 @@ const TimePicker = {
|
|||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
savePopupRef: this.savePopupRef,
|
||||
};
|
||||
},
|
||||
inject: {
|
||||
configProvider: { default: () => ({}) },
|
||||
},
|
||||
|
@ -104,6 +109,9 @@ const TimePicker = {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
savePopupRef(ref) {
|
||||
this.popupRef = ref;
|
||||
},
|
||||
handleChange(value) {
|
||||
if (!hasProp(this, 'value')) {
|
||||
this.setState({ sValue: value });
|
||||
|
|
|
@ -77,6 +77,7 @@ export default {
|
|||
},
|
||||
inject: {
|
||||
vcTriggerContext: { default: () => ({}) },
|
||||
savePopupRef: { default: () => noop },
|
||||
},
|
||||
data() {
|
||||
const props = this.$props;
|
||||
|
@ -350,6 +351,7 @@ export default {
|
|||
},
|
||||
savePopup(node) {
|
||||
this._component = node;
|
||||
this.savePopupRef(node);
|
||||
},
|
||||
getComponent() {
|
||||
const self = this;
|
||||
|
|
Loading…
Reference in New Issue