diff --git a/src/area/index.js b/src/area/index.js index a6bb4c978..60ec8ec2c 100644 --- a/src/area/index.js +++ b/src/area/index.js @@ -1,4 +1,12 @@ -import { ref, watch, computed, reactive, nextTick, onMounted } from 'vue'; +import { + ref, + watch, + computed, + reactive, + nextTick, + onMounted, + getCurrentInstance, +} from 'vue'; import { createNamespace, pick } from '../utils'; import { pickerProps } from '../picker/shared'; import Picker from '../picker'; @@ -273,11 +281,12 @@ export default createComponent({ } ); - return (vm) => { - // @exposed-api - vm.reset = reset; - vm.getArea = getArea; + // @exposed-api + const vm = getCurrentInstance().proxy; + vm.reset = reset; + vm.getArea = getArea; + return () => { const columns = state.columns.slice(0, +props.columnsNum); return ( diff --git a/src/calendar/components/Month.js b/src/calendar/components/Month.js index 5bd6591d0..24d47f979 100644 --- a/src/calendar/components/Month.js +++ b/src/calendar/components/Month.js @@ -1,4 +1,4 @@ -import { ref, computed } from 'vue'; +import { ref, computed, getCurrentInstance } from 'vue'; import { createNamespace, addUnit } from '../../utils'; import { unitToPx } from '../../utils/format/unit'; import { setScrollTop } from '../../utils/dom/scroll'; @@ -246,19 +246,19 @@ export default createComponent({ return
; }; - return (vm) => { - vm.getDate = getDate; - vm.getTitle = getTitle; - vm.getHeight = getHeight; - vm.setVisible = setVisible; - vm.scrollIntoView = scrollIntoView; + // @exposed-api + const vm = getCurrentInstance().proxy; + vm.getDate = getDate; + vm.getTitle = getTitle; + vm.getHeight = getHeight; + vm.setVisible = setVisible; + vm.scrollIntoView = scrollIntoView; - return ( -