Skip to content

Instantly share code, notes, and snippets.

View index.html
<div id="app">
<input type="checkbox" :checked="selected">
<button @click="toggle">toggle</button>
</div>
View index.html
<div id="app">
<button :type="selected">selected</button>
</div>
@PKTseng
PKTseng / index.html
Created Aug 4, 2020
修飾符-box-stop、self
View index.html
<div id="app">
<div class="box" @click.self="msg = 'c'">
<div class="box" @click.self="msg = 'b'">
<div class="box" @click.stop="msg = 'a'">
</div>
</div>
</div>
<h1>{{msg}}</h1>
</div>
View index.html
<div id="app">
<div class="box" @click="msg = 'c'">
<div class="box" @click="msg = 'b'">
<div class="box" @click="msg = 'a'">
</div>
</div>
</div>
<h1>{{msg}}</h1>
</div>
View index.html
<div id="app">
<div class="box" @click="msg = 'a'">
<div class="box" @click="msg = 'b'">
<div class="box" @click="msg = 'c'">
</div>
</div>
</div>
<h1>{{msg}}</h1>
</div>
@PKTseng
PKTseng / index.html
Created Aug 4, 2020
修飾符-preventDefault-法二
View index.html
<div id="app">
<a
href="https://www.google.com/"
target="_blank"
@click.prevent="linkClick"
>
google
</a>
</div>
View index.html
<div id="app">
<a
href="https://www.google.com/"
target="_blank"
@click="linkClick"
>
google
</a>
</div>
View index.html
<div id="app">
<a
href="https://www.google.com/"
target="_blank"
@click="linkClick"
>
google
</a>
</div>
@PKTseng
PKTseng / index.html
Created Aug 4, 2020
偵聽按鍵事件keyCode簡短-任意鍵
View index.html
<div id="app">
<input v-model="input" @keydown.prevent.f5="keydown">
<ul>
<li v-for="item in list">{{item}}</li>
</ul>
</div>
You can’t perform that action at this time.