From 8c0fd7b51787d6b686489f333551b096c695c464 Mon Sep 17 00:00:00 2001 From: skirtle <65301168+skirtles-code@users.noreply.github.com> Date: Thu, 20 May 2021 21:45:43 +0100 Subject: [PATCH] fix: use method shorthands and switch indexOf to includes --- 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 30dd6bdcca..e8d2ee60dc 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, // Object or array defaults must be returned from // a factory function - default: function() { + default() { return { message: 'hello' } } }, // Custom validator function propF: { - validator: function(value) { + validator(value) { // The value must match one of these strings - return ['success', 'warning', 'danger'].indexOf(value) !== -1 + return ['success', 'warning', 'danger'].includes(value) } }, // Function with a default value propG: { type: Function, // Unlike object or array default, this is not a factory function - this is a function to serve as a default value - default: function() { + default() { return 'Default function' } }