fix(ImagePreview): failed to drag image

This commit is contained in:
chenjiahan 2020-09-14 17:41:41 +08:00
parent 6ab2b3bf1f
commit ea846033f7

View File

@ -70,7 +70,6 @@ export default createComponent({
emits: ['scale', 'close', 'closed', 'change', 'update:show'], emits: ['scale', 'close', 'closed', 'change', 'update:show'],
setup(props, { emit, slots }) { setup(props, { emit, slots }) {
const rootRef = ref();
const swipeRef = ref(); const swipeRef = ref();
const state = reactive({ const state = reactive({
@ -80,9 +79,8 @@ export default createComponent({
}); });
const resize = () => { const resize = () => {
const root = rootRef.value; if (swipeRef.value) {
if (root && root.getBoundingClientRect) { const rect = swipeRef.value.$el.getBoundingClientRect();
const rect = root.getBoundingClientRect();
state.rootWidth = rect.width; state.rootWidth = rect.width;
state.rootHeight = rect.height; state.rootHeight = rect.height;
} }
@ -207,7 +205,6 @@ export default createComponent({
return () => ( return () => (
<Popup <Popup
ref={rootRef}
show={props.show} show={props.show}
class={[bem(), props.className]} class={[bem(), props.className]}
overlayClass={bem('overlay')} overlayClass={bem('overlay')}