Skip to content

Commit 6730d26

Browse files
fix: use method shorthands and switch indexOf to includes (#1061)
1 parent e465293 commit 6730d26

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/guide/component-props.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ data() {
145145
```js
146146
props: ['size'],
147147
computed: {
148-
normalizedSize: function () {
148+
normalizedSize() {
149149
return this.size.trim().toLowerCase()
150150
}
151151
}
@@ -183,22 +183,22 @@ app.component('my-component', {
183183
type: Object,
184184
// Object or array defaults must be returned from
185185
// a factory function
186-
default: function() {
186+
default() {
187187
return { message: 'hello' }
188188
}
189189
},
190190
// Custom validator function
191191
propF: {
192-
validator: function(value) {
192+
validator(value) {
193193
// The value must match one of these strings
194-
return ['success', 'warning', 'danger'].indexOf(value) !== -1
194+
return ['success', 'warning', 'danger'].includes(value)
195195
}
196196
},
197197
// Function with a default value
198198
propG: {
199199
type: Function,
200200
// Unlike object or array default, this is not a factory function - this is a function to serve as a default value
201-
default: function() {
201+
default() {
202202
return 'Default function'
203203
}
204204
}

0 commit comments

Comments
 (0)