This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
todos.length ? ( | |
<ul> | |
{ todos.forEach(todo => todo && <li>{todo}</li>) } | |
</ul> | |
) : ( | |
<p>No todos left!</p> | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul v-if="todos.length"> | |
<li v-for="todo in todos" v-if="todo"> // v-if here just for example to compare, although official not recommend like this | |
{{ todo }} | |
</li> | |
</ul> | |
<p v-else>No todos left!</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<p | |
class="foo" | |
:class="align" | |
:style="color: fontColor" | |
> | |
{{name}} | |
</p> | |
</template> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render(){ | |
const { fontColor, align } = this.props | |
const { name } = this.state | |
return ( | |
<p | |
className={`${fontColor} ${align} foo`} | |
style="color: fontColor" | |
> | |
{name} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<p>{{slogan}}</p> | |
</template> | |
<script> | |
props:['middName'], | |
data: { | |
firstName: 'I', | |
lastName: 'Cat' | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- the click events propagation will be stopped --> | |
<a @click.stop="doThis"></a> | |
<!-- the submit event will no longer reload the page --> | |
<form @submit.prevent="onSubmit"></form> | |
<!-- modifiers can be chained --> | |
<a @click.stop.prevent="doThat"></a> | |
<!-- just the modifier --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myMixin = { | |
created: function () { | |
this.hello() | |
}, | |
methods: { | |
hello: function () { | |
console.log('hello from mixin!') | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<select v-model="selected" multiple> | |
<option>Grapefruit</option> | |
<option>Lime</option> | |
<option>Coconut</option> | |
<option>Mango</option> | |
</select> | |
<span>Select value: {{ selected }}</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Select extends React.Component { | |
state = { | |
selected: [], | |
fruits: [ | |
{value: "banana", isChecked: false}, | |
{value: "apple", isChecked: false}, | |
{value: "mango", isChecked: false}, | |
{value: "grap", isChecked: false} | |
] | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<a class="primary">GitHub</a> | |
</template> | |
<style scoped> | |
a { | |
background: transparent; | |
color: white; | |
} | |
a.primary { |
NewerOlder