Skip to content

[pull] indonesian from master #219

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 3 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/guide/a11y-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You should add a link at the top of each page that goes directly to the main con

Typically this is done on the top of `App.vue` as it will be the first focusable element on all your pages:

``` html
```html
<ul class="skip-links">
<li>
<a href="#main" ref="skipLink">Skip to main content</a>
Expand All @@ -22,7 +22,7 @@ Typically this is done on the top of `App.vue` as it will be the first focusable

To hide the link unless it is focused, you can add the following style:

``` css
```css
.skipLink {
white-space: nowrap;
margin: 1em auto;
Expand All @@ -42,7 +42,7 @@ To hide the link unless it is focused, you can add the following style:

Once a user changes route, bring focus back to the skip link. This can be achieved by calling focus to the `ref` provided below:

``` vue
```vue
<script>
export default {
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/guide/component-edge-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ However, if you've ruled out the above and find yourself in this extremely rare

Rendering plain HTML elements is very fast in Vue, but sometimes you might have a component that contains **a lot** of static content. In these cases, you can ensure that it's only evaluated once and then cached by adding the `v-once` directive to the root element, like this:

``` js
```js
app.component('terms-of-service', {
template: `
<div v-once>
Expand Down
4 changes: 2 additions & 2 deletions src/guide/migration/custom-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ It's generally recommended to keep directives independent of the component insta

In Vue 2, the component instance had to be accessed through the `vnode` argument:

```javascript
```js
bind(el, binding, vnode) {
const vm = vnode.context
}
```

In Vue 3, the instance is now part of the `binding`:

```javascript
```js
mounted(el, binding, vnode) {
const vm = binding.instance
}
Expand Down
2 changes: 1 addition & 1 deletion src/guide/migration/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If you are using filters that were globally registered and then used throughout

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/guide/migration/listeners-removed.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ badges:

The `$listeners` object has been removed in Vue 3. Event listeners are now part of `$attrs`:

```javascript
```js
{
text: 'this is an attribute',
onClose: () => console.log('close Event triggered')
Expand Down Expand Up @@ -54,7 +54,7 @@ export default {

If this component received an `id` attribute and a `v-on:close` listener, the `$attrs` object will now look like this:

```javascript
```js
{
id: 'my-input',
onClose: () => console.log('close Event triggered')
Expand Down
29 changes: 28 additions & 1 deletion src/guide/render-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ For the `.passive`, `.capture`, and `.once` event modifiers, they can be concate

For example:

```javascript
```js
render() {
return h('input', {
onClickCapture: this.doThisInCapturingMode,
Expand Down Expand Up @@ -567,6 +567,33 @@ render () {
}
```

## Return Values for Render Functions

In all of the examples we've seen so far, the `render` function has returned a single root VNode. However, there are alternatives.

Returning a string will create a text VNode, without any wrapping element:

```js
render() {
return 'Hello world!'
}
```

We can also return an array of children, without wrapping them in a root node. This creates a fragment:

```js
// Equivalent to a template of `Hello<br>world!`
render() {
return [
'Hello',
h('br'),
'world!'
]
}
```

If a component needs to render nothing, perhaps because data is still loading, it can just return `null`. This will be rendered as a comment node in the DOM.

## JSX

If we're writing a lot of `render` functions, it might feel painful to write something like this:
Expand Down
4 changes: 2 additions & 2 deletions src/guide/single-file-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ touch rollup.config.js

Once the file is created we will need to open it with our editor of choice and add the following code.

```javascript
```js
// import our third party plugins
import commonjs from 'rollup-plugin-commonjs'
import VuePlugin from 'rollup-plugin-vue'
Expand Down Expand Up @@ -144,7 +144,7 @@ Here we are specifying:
To also build `umd` and `cjs` modules we can simply add a few lines of configuration to our `rollup.config.js` and `package.json`

##### rollup.config.js
```javascript
```js
output: [
...
{
Expand Down
Loading