Skip to content

Commit 4ad162d

Browse files
brandedoutcastchrisvfritz
authored andcommitted
Update filters, global filters needs to go before Vue instance creation (#1392)
Global filters defined after creating the Vue instance throws `Failed to resolve filter`. Reference https://forum.vuejs.org/t/global-filters-failing-to-resolve-inside-single-file-components/21863/6
1 parent aafb90c commit 4ad162d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/v2/guide/filters.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ filters: {
2626
}
2727
```
2828

29-
or define a filter globally:
29+
or define a filter globally before creating the Vue instance:
3030

3131
``` js
3232
Vue.filter('capitalize', function (value) {
3333
if (!value) return ''
3434
value = value.toString()
3535
return value.charAt(0).toUpperCase() + value.slice(1)
3636
})
37+
38+
new Vue({
39+
// ...
40+
})
3741
```
3842

3943
Below is an example of our `capitalize` filter being used:

0 commit comments

Comments
 (0)