Skip to content

docs: correct minor problems with the guide to migrating global filters #599

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 1 commit into from
Oct 5, 2020
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
10 changes: 5 additions & 5 deletions src/guide/migration/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ Instead of using filters, we recommend replacing them with computed properties o

### Global Filters

If you are using filters that were globally registered and then used throughout our app, it's likely not convenient to replace them with computed props or methods in each individual component.
If you are using filters that were globally registered and then used throughout your app, it's likely not convenient to replace them with computed properties or methods in each individual component.

Instead, you can make your global filters available to all components through `app.globalProperties`:
Instead, you can make your global filters available to all components through [globalProperties](../../api/application-config.html#globalproperties):

```javascript
// main.js
const app = createApp(App)

app.config.globalProperties.$filters = {
accountInUSD(num) {
return '$' + num
currencyUSD(value) {
return '$' + value
}
}
```
Expand All @@ -95,7 +95,7 @@ Then you can fix all templates using this `$filters` object like this:
```html
<template>
<h1>Bank Account Balance</h1>
<p>{{ $filters.accountInUSD(accountInUSD) }}</p>
<p>{{ $filters.currencyUSD(accountBalance) }}</p>
</template>
```

Expand Down