refactor(Tabbar): refactor with composition api

This commit is contained in:
chenjiahan
2020-08-28 15:19:16 +08:00
parent e3cf460762
commit f843e6def9
7 changed files with 117 additions and 132 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { ref, reactive, nextTick, onActivated, watch } from 'vue';
import { createNamespace, isDef } from '../utils';
import { doubleRaf } from '../utils/dom/raf';
import { useWidth } from '../composition/use-rect';
import { useRect } from '../composition/use-rect';
import Icon from '../icon';
const [createComponent, bem] = createNamespace('notice-bar');
@@ -139,8 +139,8 @@ export default createComponent({
return;
}
const wrapRefWidth = useWidth(wrapRef);
const contentRefWidth = useWidth(contentRef);
const wrapRefWidth = useRect(wrapRef).width;
const contentRefWidth = useRect(contentRef).width;
if (scrollable || contentRefWidth > wrapRefWidth) {
doubleRaf(() => {