From 09ae8164e1a8c8d2c932d43595eca88c043b8d67 Mon Sep 17 00:00:00 2001 From: Naoki Endoh Date: Tue, 8 Jun 2021 20:52:18 +0900 Subject: [PATCH] fix: use method shorthands and switch indexOf to includes https://github.com/vuejs/docs-next/commit/6730d261f6ac9be243194a5e7beefb1ebbe46945 --- src/guide/component-props.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/guide/component-props.md b/src/guide/component-props.md index 7dc9e409..44708079 100644 --- a/src/guide/component-props.md +++ b/src/guide/component-props.md @@ -145,7 +145,7 @@ data() { ```js props: ['size'], computed: { - normalizedSize: function () { + normalizedSize() { return this.size.trim().toLowerCase() } } @@ -183,22 +183,22 @@ app.component('my-component', { type: Object, // オブジェクトもしくは配列のデフォルト値は // 必ずファクトリ関数(それを生み出すための関数)を返す必要があります。 - default: function() { + default() { return { message: 'hello' } } }, // カスタムバリデーション関数 propF: { - validator: function(value) { + validator(value) { // プロパティの値は、必ずいずれかの文字列でなければならない - return ['success', 'warning', 'danger'].indexOf(value) !== -1 + return ['success', 'warning', 'danger'].includes(value) } }, // デフォルト値つきの関数型 propG: { type: Function, // オブジェクトや配列のデフォルトとは異なり、これはファクトリ関数ではありません。これは、デフォルト値としての関数を取り扱います。 - default: function() { + default() { return 'Default function' } }