This file contains 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 myName = '驚不驚喜'; | |
function callName() { | |
console.log(this,this.myName); | |
} | |
var family = { | |
myName: '來因', | |
callName: callName, | |
ana: { | |
myName: '安納', | |
callName: callName |
This file contains 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 myName = '驚不驚喜'; | |
function callName() { | |
console.log(this,this.myName); | |
} | |
var family = { | |
myName: '來因', | |
callName: function () { | |
console.log(this, this.myName); | |
} | |
} |
This file contains 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 id="app"> | |
<li v-for = "(items,index) in arrayData" > | |
{{index}}-{{items.name}}-{{items.age}} | |
</li> | |
</ul> | |
<button class="btn btn-outline-primary" @click="reverseArray">反轉陣列</button> |
This file contains 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 app = new Vue({ | |
el:"#app", | |
data:{ | |
arrayData: [ | |
{ | |
name: '小明', | |
age: 16 | |
}, | |
{ | |
name: '漂亮阿姨', |
This file contains 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 id="app"> | |
<li v-for="(item, key) in arrayData" :key='item.age'> | |
{{ key }} - {{ item.name }} {{ item.age }} 歲 <input type="text" > | |
</li> | |
</ul> | |
<button class="btn btn-outline-primary" @click="reverseArray">反轉陣列</button> |
This file contains 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 app = new Vue({ | |
el:"#app", | |
data:{ | |
arrayData: [ | |
{ | |
name: '小明', | |
age: 16 | |
}, | |
{ | |
name: '漂亮阿姨', |
This file contains 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
<div id='app'> | |
<input type="text" class="form-control" v-model="filterText" @keyup.enter='filterData> | |
<ul> | |
<li v-for="(item, key) in filterArray" :key="item.age"> | |
{{ key }} - {{ item.name }} {{ item.age }} 歲 <input type="text"> | |
</li> | |
</ul> | |
</div> |
This file contains 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 app = new Vue({ | |
el: '#app', | |
data: { | |
filterArray: [], | |
filterText: '', | |
arrayData: [ | |
{ | |
name: '小明', | |
age: 16 | |
}, |
This file contains 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
<div id='app'> | |
<p>請加上 v-if 判斷式</p> | |
<ul> | |
<li v-for="(item, key) in arrayData" v-if=" item.age <= 19"> | |
{{ key }} - {{ item.name }} {{ item.age }} 歲 | |
</li> | |
</ul> | |
</div> |
This file contains 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
new Vue({ | |
el:"#app", | |
data:{ | |
selected: 'submit', | |
}, | |
}) |