Skip to content

Commit f7fc998

Browse files
logustramazipan
authored andcommitted
Filters (#60)
* Link to custom-elements-everywhere.com (vuejs#2039) The site <https://custom-elements-everywhere.com> runs a suite of tests against a framework to identify interoperability issues, and highlight potential fixes already implemented in other frameworks. This is a great way to give more confidence while choosing Vue. * Updated Nuxtent link (vuejs#2041) * Fix wrong statement about arrow function and bound this (vuejs#2040) * Fix wrong statement about arrow function and bound this Stating that arrow functions are bound to it's parent `this` is wrong, arrow functions does not have a `this` at all. More: https://twitter.com/getify/status/1101521219243966466 * Update src/v2/guide/instance.md Co-Authored-By: KadoBOT <ricardo.ambrogi@gmail.com> * Update instance.md Remove unnecessary `a` * translate filters * fix translate filters * update translate filters
1 parent b523269 commit f7fc998

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/v2/cookbook/serverless-blog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ created() {
298298

299299
## Alternative Patterns
300300

301-
An alternative pattern to consider, especially if you prefer writing only in Markdown, is using something like [Nuxtent](https://nuxtent.now.sh/guide/writing#async-components). Nuxtent allows you to use `Vue Component` inside of Markdown files. This approach would be akin to a static site approach (i.e. Jekyll) where you compose your blog posts in Markdown files. Nuxtent adds a nice integration between Vue.js and Markdown allowing you to live in a 100% Vue.js world.
301+
An alternative pattern to consider, especially if you prefer writing only in Markdown, is using something like [Nuxtent](https://nuxtent-module.netlify.com/guide/writing/#async-components). Nuxtent allows you to use `Vue Component` inside of Markdown files. This approach would be akin to a static site approach (i.e. Jekyll) where you compose your blog posts in Markdown files. Nuxtent adds a nice integration between Vue.js and Markdown allowing you to live in a 100% Vue.js world.
302302

303303
## Wrap up
304304

src/v2/guide/filters.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
title: Filters
2+
title: Filter
33
type: guide
44
order: 305
55
---
66

7-
Vue.js allows you to define filters that can be used to apply common text formatting. Filters are usable in two places: **mustache interpolations and `v-bind` expressions** (the latter supported in 2.1.0+). Filters should be appended to the end of the JavaScript expression, denoted by the "pipe" symbol:
7+
Vue.js memungkinkan Anda untuk menentukan filter yang dapat digunakan untuk memformat tulisan. Filter dapat digunakan di dua tempat: **interpolasi mustache dan ekspresi `v-bind`** (terakhir didukung di 2.1.0+). Filter harus ditambahkan di akhir ekspresi JavaScript dengan simbol "pipe" ( | ):
88

99
``` html
10-
<!-- in mustaches -->
10+
<!-- di mustaches -->
1111
{{ message | capitalize }}
1212

13-
<!-- in v-bind -->
13+
<!-- di v-bind -->
1414
<div v-bind:id="rawId | formatId"></div>
1515
```
1616

17-
You can define local filters in a component's options:
17+
Anda dapat menentukan filter lokal dalam opsi komponen:
1818

1919
``` js
2020
filters: {
@@ -26,7 +26,7 @@ filters: {
2626
}
2727
```
2828

29-
or define a filter globally before creating the Vue instance:
29+
atau menentukan filter secara global sebelum membuat Vue instance:
3030

3131
``` js
3232
Vue.filter('capitalize', function (value) {
@@ -40,7 +40,7 @@ new Vue({
4040
})
4141
```
4242

43-
Below is an example of our `capitalize` filter being used:
43+
Di bawah ini adalah contoh dari filter `capitalize` yang kami gunakan:
4444

4545
{% raw %}
4646
<div id="example_1" class="demo">
@@ -66,20 +66,20 @@ Below is an example of our `capitalize` filter being used:
6666
</script>
6767
{% endraw %}
6868

69-
The filter's function always receives the expression's value (the result of the former chain) as its first argument. In the above example, the `capitalize` filter function will receive the value of `message` as its argument.
69+
Filter selalu menerima nilai ekspresi (hasil dari rantai sebelumnya) sebagai argumen pertama. Dalam contoh di atas, filter `capitalize` akan menerima nilai `message` sebagai argumen.
7070

71-
Filters can be chained:
71+
Filter bisa berantai:
7272

7373
``` html
7474
{{ message | filterA | filterB }}
7575
```
7676

77-
In this case, `filterA`, defined with a single argument, will receive the value of `message`, and then the `filterB` function will be called with the result of `filterA` passed into `filterB`'s single argument.
77+
Pasa kasus ini, `filterA`, didefinisikan dengan satu argumen, yang akan menerima nilai `message`, kemudian `filterB` akan dipanggil dengan hasil dari `filterA` yang akan dilanjutkan ke `filterB` sebagai satu argumen.
7878

79-
Filters are JavaScript functions, therefore they can take arguments:
79+
Filter adalah fungsi JavaScript, oleh karena itu mereka dapat mengambil argumen:
8080

8181
``` html
8282
{{ message | filterA('arg1', arg2) }}
8383
```
8484

85-
Here `filterA` is defined as a function taking three arguments. The value of `message` will be passed into the first argument. The plain string `'arg1'` will be passed into the `filterA` as its second argument, and the value of expression `arg2` will be evaluated and passed in as the third argument.
85+
Di sini `filterA` didefinisikan sebagai fungsi yang mengambil tiga argumen. Nilai `message` yang akan dilanjutkan ke argumen pertama. String `'arg1'` yang akan di lanjutkan ke `filterA` sebagian argumen kedua, dan nilai dari ekspresi `arg2` akan dievaluasi dan diteruskan sebagai argumen ketiga.

src/v2/guide/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ You may have noticed that Vue components are very similar to **Custom Elements**
393393

394394
2. Vue components provide important features that are not available in plain custom elements, most notably cross-component data flow, custom event communication and build tool integrations.
395395

396+
Although Vue doesn't use custom elements internally, it has [great interoperability](https://custom-elements-everywhere.com/#vue) when it comes to consuming or distributing as custom elements. Vue CLI also supports building Vue components that register themselves as native custom elements.
397+
396398
## Ready for More?
397399

398400
We've briefly introduced the most basic features of Vue.js core - the rest of this guide will cover them and other advanced features with much finer details, so make sure to read through it all!

0 commit comments

Comments
 (0)