Skip to content

API Reference > Application Config の翻訳を追従 #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions src/api/application-config.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
# アプリケーション構成

`config` は、 Vue アプリケーションのグローバル設定を含むオブジェクトです。アプリケーションをマウントする前に、以下のプロパティを変更できます:
すべての Vue アプリケーションは、そのアプリケーションの構成設定を含む `config` オブジェクトを公開します:

```js
const app = Vue.createApp({})
const app = createApp({})

app.config = {...}
console.log(app.config)
```

## devtools

- **型:** `boolean`

- **デフォルト:** `true` (プロダクションビルドでは `false`)

- **使用方法:**

```js
app.config.devtools = true
```

[vue-devtools](https://github.com/vuejs/vue-devtools) による検査を許可するかどうかを設定します。このオプションのデフォルト値は、development ビルドでは `true` に、プロダクションビルドでは `false` となります。true にすることで、プロダクションビルドで検査を有効にできます。
アプリケーションをマウントする前に、以下に列挙したプロパティを変更することができます。

## errorHandler

Expand Down Expand Up @@ -78,14 +66,14 @@ app.component('child-component', {

アプリケーション内のあらゆるコンポーネントのインスタンスからアクセスできるグローバルなプロパティを追加します。名称が競合した場合、コンポーネントのプロパティが優先されます。

これは、 Vue 2.x における Vue.prototype` 拡張を置き換えることができます:
これは、 Vue 2.x における `Vue.prototype` 拡張を置き換えることができます:

```js
// Before
Vue.prototype.$http = () => {}

// After
const app = Vue.createApp({})
const app = createApp({})
app.config.globalProperties.$http = () => {}
```

Expand All @@ -106,6 +94,10 @@ Vue の外部にて定義された(Web Components API を利用した場合な

> この関数では、全てのネイティブの HTML ならびに SVG のタグをマッチさせる必要はありません。Vue のパーサが自動的にこのチェックを行います。

::: tip Important
この設定オプションは、ランタイムコンパイラを使うときにのみ尊重されます。ランタイム限定ビルドを使う場合、 `isCustomElement` は代わりにビルドの設定で `@vue/compiler-dom` に渡す必要があります。例えば、 [vue-loader の `compilerOptions` オプション](https://vue-loader.vuejs.org/options.html#compileroptions) を経由して渡します。
:::

## optionMergeStrategies

- **型:** `{ [key: string]: Function }`
Expand All @@ -115,7 +107,7 @@ Vue の外部にて定義された(Web Components API を利用した場合な
- **使用方法:**

```js
const app = Vue.createApp({
const app = createApp({
mounted() {
console.log(this.$options.hello)
}
Expand All @@ -134,9 +126,9 @@ app.mixin({

カスタムオプションのマージ戦略を定義します。

マージ戦略は、親インスタンスと子インスタンスで定義されたオプションの値をそれぞれ第一引数と第二引数として受け取ります。アプリケーションコンテキストのインスタンスは、第三引数として渡されます
マージ戦略は、親インスタンスと子インスタンスで定義されたオプションの値をそれぞれ第 1 引数と第 2 引数として受け取ります。アプリケーションコンテキストのインスタンスは、第 3 引数として渡されます

- **こちらも:** [Custom Option Merging Strategies](../guide/mixins.html#custom-option-merge-strategies)
- **参照:** [Custom Option Merging Strategies](../guide/mixins.html#custom-option-merge-strategies)

## performance

Expand Down