From 3044a81a605414b1506ccf58e205c85575ea4df8 Mon Sep 17 00:00:00 2001 From: DY_XiaoDong Date: Fri, 3 May 2024 15:34:05 +0800 Subject: [PATCH 001/280] docs: add warning to custom-directives (#2850) * docs: add warning to custom-directives * Update src/guide/reusability/custom-directives.md --------- Co-authored-by: Natalia Tepluhina --- src/guide/reusability/custom-directives.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/guide/reusability/custom-directives.md b/src/guide/reusability/custom-directives.md index bbc5a7dc..536fff32 100644 --- a/src/guide/reusability/custom-directives.md +++ b/src/guide/reusability/custom-directives.md @@ -210,6 +210,11 @@ app.directive('demo', (el, binding) => { ## Usage on Components {#usage-on-components} +:::warning Not recommended +Using custom directives on components is not recommended, unexpected behaviour may occur when a component has multiple root nodes. +::: + + When used on components, custom directives will always apply to a component's root node, similar to [Fallthrough Attributes](/guide/components/attrs). ```vue-html @@ -224,4 +229,4 @@ When used on components, custom directives will always apply to a component's ro ``` -Note that components can potentially have more than one root node. When applied to a multi-root component, a directive will be ignored and a warning will be thrown. Unlike attributes, directives can't be passed to a different element with `v-bind="$attrs"`. In general, it is **not** recommended to use custom directives on components. +Note that components can potentially have more than one root node. When applied to a multi-root component, a directive will be ignored and a warning will be thrown. Unlike attributes, directives can't be passed to a different element with `v-bind="$attrs"`. From a95e91000f166d5e2e63d6692411546982bd440e Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 3 May 2024 10:01:47 -0700 Subject: [PATCH 002/280] bring back the uwu logo --- .vitepress/config.ts | 8 ++++++++ .vitepress/inlined-scripts/uwu.js | 3 +++ .vitepress/theme/components/Home.vue | 20 ++++++++++++++++++++ src/public/logo-uwu.png | Bin 0 -> 93369 bytes 4 files changed, 31 insertions(+) create mode 100644 .vitepress/inlined-scripts/uwu.js create mode 100644 src/public/logo-uwu.png diff --git a/.vitepress/config.ts b/.vitepress/config.ts index b491dfdb..bc6b2af2 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -605,6 +605,14 @@ export default defineConfigWithTheme({ 'utf-8' ) ], + [ + 'script', + {}, + fs.readFileSync( + path.resolve(__dirname, './inlined-scripts/uwu.js'), + 'utf-8' + ) + ], [ 'script', { diff --git a/.vitepress/inlined-scripts/uwu.js b/.vitepress/inlined-scripts/uwu.js new file mode 100644 index 00000000..5b25107e --- /dev/null +++ b/.vitepress/inlined-scripts/uwu.js @@ -0,0 +1,3 @@ +if (location.search.includes('?uwu')) { + document.documentElement.classList.add('uwu') +} diff --git a/.vitepress/theme/components/Home.vue b/.vitepress/theme/components/Home.vue index 2debf8e8..2ab0b880 100644 --- a/.vitepress/theme/components/Home.vue +++ b/.vitepress/theme/components/Home.vue @@ -11,6 +11,7 @@ onMounted(load)