From b549e8c37a147c699d872ca421debdab9b9a51b3 Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Thu, 28 Apr 2022 19:12:28 +0300 Subject: [PATCH] Remove style guide recommendation on global base components Right now official Vue Style Guide suggests you use global components when you deal with base components. This can lead to confusion with new developers coming to a project, IDE assistance and testing. This PR removes this recommendation so it's always obvious how components are imported. --- src/v2/style-guide/index.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/v2/style-guide/index.md b/src/v2/style-guide/index.md index 40caa799f0..5cf4b3ee20 100644 --- a/src/v2/style-guide/index.md +++ b/src/v2/style-guide/index.md @@ -771,22 +771,6 @@ Some advantages of this convention: - Since component names should always be multi-word, this convention prevents you from having to choose an arbitrary prefix for simple component wrappers (e.g. `MyButton`, `VueButton`). -- Since these components are so frequently used, you may want to simply make them global instead of importing them everywhere. A prefix makes this possible with Webpack: - - ``` js - var requireComponent = require.context("./src", true, /Base[A-Z]\w+\.(vue|js)$/) - requireComponent.keys().forEach(function (fileName) { - var baseComponentConfig = requireComponent(fileName) - baseComponentConfig = baseComponentConfig.default || baseComponentConfig - var baseComponentName = baseComponentConfig.name || ( - fileName - .replace(/^.+\//, '') - .replace(/\.\w+$/, '') - ) - Vue.component(baseComponentName, baseComponentConfig) - }) - ``` - {% raw %}{% endraw %} {% raw %}
{% endraw %}