Commit e9e51b2fdc879a66d8df08504a0955c9c21e3e27

Authored by Vben
1 parent 1bde4041

perf(scrollbar): scrollbar update when slot changed

package.json
... ... @@ -66,7 +66,7 @@
66 66 "devDependencies": {
67 67 "@commitlint/cli": "^12.1.4",
68 68 "@commitlint/config-conventional": "^12.1.4",
69   - "@iconify/json": "^1.1.361",
  69 + "@iconify/json": "^1.1.362",
70 70 "@purge-icons/generated": "^0.7.0",
71 71 "@types/codemirror": "^5.60.1",
72 72 "@types/crypto-js": "^4.0.1",
... ... @@ -83,9 +83,9 @@
83 83 "@types/sortablejs": "^1.10.6",
84 84 "@typescript-eslint/eslint-plugin": "^4.28.0",
85 85 "@typescript-eslint/parser": "^4.28.0",
86   - "@vitejs/plugin-legacy": "^1.4.2",
87   - "@vitejs/plugin-vue": "^1.2.3",
88   - "@vitejs/plugin-vue-jsx": "^1.1.5",
  86 + "@vitejs/plugin-legacy": "^1.4.3",
  87 + "@vitejs/plugin-vue": "^1.2.4",
  88 + "@vitejs/plugin-vue-jsx": "^1.1.6",
89 89 "@vue/compiler-sfc": "3.1.2",
90 90 "@vue/test-utils": "^2.0.0-rc.9",
91 91 "autoprefixer": "^10.2.6",
... ...
src/components/Scrollbar/src/Scrollbar.vue
... ... @@ -29,6 +29,7 @@
29 29 nextTick,
30 30 provide,
31 31 computed,
  32 + watch,
32 33 unref,
33 34 } from 'vue';
34 35 import Bar from './bar';
... ... @@ -64,7 +65,7 @@
64 65 default: 'div',
65 66 },
66 67 },
67   - setup(props) {
  68 + setup(props, { slots }) {
68 69 const sizeWidth = ref('0');
69 70 const sizeHeight = ref('0');
70 71 const moveX = ref(0);
... ... @@ -81,6 +82,13 @@
81 82 return props.wrapStyle;
82 83 });
83 84  
  85 + watch(
  86 + () => slots.default?.(),
  87 + () => {
  88 + nextTick(update);
  89 + }
  90 + );
  91 +
84 92 const handleScroll = () => {
85 93 if (!props.native) {
86 94 moveY.value = (unref(wrap).scrollTop * 100) / unref(wrap).clientHeight;
... ...
yarn.lock
... ... @@ -53,7 +53,7 @@
53 53 resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.14.5.tgz#8ef4c18e58e801c5c95d3c1c0f2874a2680fadea"
54 54 integrity sha512-kixrYn4JwfAVPa0f2yfzc2AWti6WRRyO3XjWW5PJAvtE11qhSayrrcrEnee05KAtNaPC+EwehE8Qt1UedEVB8w==
55 55  
56   -"@babel/core@>=7.9.0", "@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.12.10", "@babel/core@^7.7.2", "@babel/core@^7.7.5":
  56 +"@babel/core@>=7.9.0", "@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.14.6", "@babel/core@^7.7.2", "@babel/core@^7.7.5":
57 57 version "7.14.6"
58 58 resolved "https://registry.npmjs.org/@babel/core/-/core-7.14.6.tgz#e0814ec1a950032ff16c13a2721de39a8416fcab"
59 59 integrity sha512-gJnOEWSqTk96qG5BoIrl5bVtc23DCycmIePPYnamY9RboYdI4nFy5vAQMSl81O5K/W0sLDWfGysnOECC+KUUCA==
... ... @@ -791,7 +791,7 @@
791 791 dependencies:
792 792 "@babel/helper-plugin-utils" "^7.14.5"
793 793  
794   -"@babel/plugin-transform-typescript@^7.12.1":
  794 +"@babel/plugin-transform-typescript@^7.14.6":
795 795 version "7.14.6"
796 796 resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.14.6.tgz#6e9c2d98da2507ebe0a883b100cde3c7279df36c"
797 797 integrity sha512-XlTdBq7Awr4FYIzqhmYY80WN0V0azF74DMPyFqVHBvf81ZUgc4X7ZOpx6O8eLDK6iM5cCQzeyJw0ynTaefixRA==
... ... @@ -912,9 +912,9 @@
912 912 dependencies:
913 913 regenerator-runtime "^0.13.4"
914 914  
915   -"@babel/standalone@^7.14.6":
  915 +"@babel/standalone@^7.14.7":
916 916 version "7.14.7"
917   - resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.14.7.tgz#68635da005d6a34a0259599e0720d2e73133ecc3"
  917 + resolved "https://registry.npmjs.org/@babel/standalone/-/standalone-7.14.7.tgz#68635da005d6a34a0259599e0720d2e73133ecc3"
918 918 integrity sha512-7RlfMPR4604SbYpj5zvs2ZK587hVhixgU9Pd9Vs8lB8KYtT3U0apXSf0vZXhy8XRh549eUmJOHXhWKTO3ObzOQ==
919 919  
920 920 "@babel/template@^7.0.0", "@babel/template@^7.14.5", "@babel/template@^7.3.3":
... ... @@ -1189,10 +1189,10 @@
1189 1189 dependencies:
1190 1190 cross-fetch "^3.0.6"
1191 1191  
1192   -"@iconify/json@^1.1.361":
1193   - version "1.1.361"
1194   - resolved "https://registry.yarnpkg.com/@iconify/json/-/json-1.1.361.tgz#6222e7971467cc4a793c7e0bf2877b484827ae36"
1195   - integrity sha512-p7RMNFNI1YLFCJ0Ads6LOtJyLsheYM+XBSrhcTYxjuCmr2dv2j4DFp0Bh3HLwybtdPo3cA7Xo8Wqk8djvoVm/g==
  1192 +"@iconify/json@^1.1.362":
  1193 + version "1.1.362"
  1194 + resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.362.tgz#e104610f6341db0b5104794bb57959d41e5cea1b"
  1195 + integrity sha512-oKU1KvmcLX/049RXi7FJsNgiodei7LhNetls3cv+oIkTUTIa5mi88oFfRj03B6c1Vja80ZLH+mSDLeTk1fMD5A==
1196 1196  
1197 1197 "@intlify/core-base@9.1.6":
1198 1198 version "9.1.6"
... ... @@ -2228,33 +2228,33 @@
2228 2228 "@typescript-eslint/types" "4.28.0"
2229 2229 eslint-visitor-keys "^2.0.0"
2230 2230  
2231   -"@vitejs/plugin-legacy@^1.4.2":
2232   - version "1.4.2"
2233   - resolved "https://registry.yarnpkg.com/@vitejs/plugin-legacy/-/plugin-legacy-1.4.2.tgz#219e7b86a9febe62b85a66b68127a89954ed93e5"
2234   - integrity sha512-D2ADBSpImP0QT8w9Eo+8KKOLg3I8OQhFwuBXGM8WQCRrEs55E3bCf9PTkL8S+tgliyLbJM+gjemxpRuoTTwphA==
  2231 +"@vitejs/plugin-legacy@^1.4.3":
  2232 + version "1.4.3"
  2233 + resolved "https://registry.npmjs.org/@vitejs/plugin-legacy/-/plugin-legacy-1.4.3.tgz#d022275d08e6f1f777891fb405816a9dd41a9f1f"
  2234 + integrity sha512-lxZUJaMWYMQuqvZM1wPzDP6KABQgA/drVL5fnaygEPcz9adc2OHhfFNN/SvvHQ1V0rP8gybIc7uA+iI1gAdkVQ==
2235 2235 dependencies:
2236   - "@babel/standalone" "^7.14.6"
2237   - core-js "^3.14.0"
  2236 + "@babel/standalone" "^7.14.7"
  2237 + core-js "^3.15.1"
2238 2238 magic-string "^0.25.7"
2239 2239 regenerator-runtime "^0.13.7"
2240 2240 systemjs "^6.10.1"
2241 2241  
2242   -"@vitejs/plugin-vue-jsx@^1.1.5":
2243   - version "1.1.5"
2244   - resolved "https://registry.npmjs.org/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-1.1.5.tgz#e856ef42f59048e59c85f8714dc8397e15f81738"
2245   - integrity sha512-YujG7IgbZR8zWGY/hZFxYKrAUdO+9OV4t3pqqQrvbtP/ESwvTY8vb0Zpw1VMO8zLWNGqf8jSbjBaCjN49diplw==
  2242 +"@vitejs/plugin-vue-jsx@^1.1.6":
  2243 + version "1.1.6"
  2244 + resolved "https://registry.npmjs.org/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-1.1.6.tgz#c9e7b63d1ebf537a24a0b4b3b31f4beb8055cef6"
  2245 + integrity sha512-1vKGALnBFt7hUIOgkC4ZAhTRgENpSgGBsdltJn3fPNcqrbrvR/HaRS5VThjCCoN69d0d+VlDXOTlWcfUpE3pfQ==
2246 2246 dependencies:
2247   - "@babel/core" "^7.12.10"
  2247 + "@babel/core" "^7.14.6"
2248 2248 "@babel/plugin-syntax-import-meta" "^7.10.4"
2249   - "@babel/plugin-transform-typescript" "^7.12.1"
  2249 + "@babel/plugin-transform-typescript" "^7.14.6"
2250 2250 "@rollup/pluginutils" "^4.1.0"
2251   - "@vue/babel-plugin-jsx" "^1.0.3"
  2251 + "@vue/babel-plugin-jsx" "^1.0.6"
2252 2252 hash-sum "^2.0.0"
2253 2253  
2254   -"@vitejs/plugin-vue@^1.2.3":
2255   - version "1.2.3"
2256   - resolved "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.2.3.tgz#2e8e008b1cc3a6ad1dfbec75743c7ffd9b4872a6"
2257   - integrity sha512-LlnLpObkGKZ+b7dcpL4T24l13nPSHLjo+6Oc7MbZiKz5PMAUzADfNJ3EKfYIQ0l0969nxf2jp/9vsfnuJ7h6fw==
  2254 +"@vitejs/plugin-vue@^1.2.4":
  2255 + version "1.2.4"
  2256 + resolved "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.2.4.tgz#a7aa6e6a31c556a8b781de730316deeecf7f56f2"
  2257 + integrity sha512-D/3H9plevPQGgQGwmV6eecvOnooLTecPR63HPffVVWPEhbfvmtYLWgznzs456NBb2DItiRTCIa1yWxvGqC+I8A==
2258 2258  
2259 2259 "@volar/code-gen@^0.25.22":
2260 2260 version "0.25.22"
... ... @@ -2301,7 +2301,7 @@
2301 2301 resolved "https://registry.npmjs.org/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.0.2.tgz#9b9c691cd06fc855221a2475c3cc831d774bc7dc"
2302 2302 integrity sha512-hz4R8tS5jMn8lDq6iD+yWL6XNB699pGIVLk7WSJnn1dbpjaazsjZQkieJoRX6gW5zpYSCFqQ7jUquPNY65tQYA==
2303 2303  
2304   -"@vue/babel-plugin-jsx@^1.0.3":
  2304 +"@vue/babel-plugin-jsx@^1.0.6":
2305 2305 version "1.0.6"
2306 2306 resolved "https://registry.npmjs.org/@vue/babel-plugin-jsx/-/babel-plugin-jsx-1.0.6.tgz#184bf3541ab6efdbe5079ab8b20c19e2af100bfb"
2307 2307 integrity sha512-RzYsvBhzKUmY2YG6LoV+W5PnlnkInq0thh1AzCmewwctAgGN6e9UFon6ZrQQV1CO5G5PeME7MqpB+/vvGg0h4g==
... ... @@ -4074,10 +4074,10 @@ core-js@^3.12.1:
4074 4074 resolved "https://registry.npmjs.org/core-js/-/core-js-3.14.0.tgz#62322b98c71cc2018b027971a69419e2425c2a6c"
4075 4075 integrity sha512-3s+ed8er9ahK+zJpp9ZtuVcDoFzHNiZsPbNAAE4KXgrRHbjSqqNN6xGSXq6bq7TZIbKj4NLrLb6bJ5i+vSVjHA==
4076 4076  
4077   -core-js@^3.14.0:
4078   - version "3.15.0"
4079   - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.15.0.tgz#db9554ebce0b6fd90dc9b1f2465c841d2d055044"
4080   - integrity sha512-GUbtPllXMYRzIgHNZ4dTYTcUemls2cni83Q4Q/TrFONHfhcg9oEGOtaGHfb0cpzec60P96UKPvMkjX1jET8rUw==
  4077 +core-js@^3.15.1:
  4078 + version "3.15.1"
  4079 + resolved "https://registry.npmjs.org/core-js/-/core-js-3.15.1.tgz#6c08ab88abdf56545045ccf5fd81f47f407e7f1a"
  4080 + integrity sha512-h8VbZYnc9pDzueiS2610IULDkpFFPunHwIpl8yRwFahAEEdSpHlTy3h3z3rKq5h11CaUdBEeRViu9AYvbxiMeg==
4081 4081  
4082 4082 core-util-is@~1.0.0:
4083 4083 version "1.0.2"
... ...