vue2.0在table中實現(xiàn)全選和反選的示例代碼-創(chuàng)新互聯(lián)

其實在去年小穎已經(jīng)寫過一篇:Vue.js實現(xiàn)checkbox的全選和反選

成都創(chuàng)新互聯(lián)公司科技有限公司專業(yè)互聯(lián)網(wǎng)基礎(chǔ)服務(wù)商,為您提供西部信息服務(wù)器托管高防服務(wù)器,成都IDC機房托管,成都主機托管等互聯(lián)網(wǎng)服務(wù)。

小穎今天在跟著慕課網(wǎng)學習vue的過程中,順便試試如何在table中實現(xiàn)全選和反選,頁面的css樣式是直接參考慕課網(wǎng)的樣式寫的,js是小穎自己寫噠,歡迎大家吐槽和點贊,嘻嘻

demo的  git 地址:ShoppingCart

頁面效果:

vue2.0在table中實現(xiàn)全選和反選的示例代碼

具體怎么實現(xiàn)的呢?

使用localstorage來存儲頁面信息 中已經(jīng)有寫項目是怎么創(chuàng)建的所以小穎在這里就不重復了,其實只是在上篇文章的基礎(chǔ)上稍微做了改動:

vue2.0在table中實現(xiàn)全選和反選的示例代碼

App.vue文件

<template>
 <div id="app">
  <router-view/>
 </div>
</template>
<script>
export default {
 name: 'app'
}

</script>
<style>
#app {
 font-family: 'Avenir', Helvetica, Arial, sans-serif;
 -webkit-font-smoothing: antialiased;
 -moz-osx-font-smoothing: grayscale;
 color: #2c3e50;
}

li,
dl,
dt,
dd,
h2,
h3,
h4,
h5,
h6,
h7,
hgroup,
p,
blockquote,
figure,
form,
fieldset,
input,
legend,
pre,
abbr,
button {
 margin: 0;
 padding: 0;
}

ul,
ol {
 list-style: none;
 margin: 0;
 padding: 0;
}

*,
*::before,
*::after {
 box-sizing: border-box;
}

div,
p,
dl,
dt,
dd {
 margin: 0;
 padding: 0;
}

a {
 color: inherit;
 text-decoration: none;
}

.checkout-title {
 position: relative;
 margin-bottom: 41px;
 text-align: center;
}

.checkout-title::before {
 position: absolute;
 top: 50%;
 left: 0;
 content: "";
 width: 100%;
 height: 1px;
 background: #ccc;
 z-index: 0;
}

.checkout-title span {
 position: relative;
 padding: 0 1em;
 background-color: #fff;
 font-family: "moderat", sans-serif;
 font-weight: bold;
 font-size: 20px;
 color: #605F5F;
 z-index: 1;
}
</style>

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

網(wǎng)頁標題:vue2.0在table中實現(xiàn)全選和反選的示例代碼-創(chuàng)新互聯(lián)
本文路徑:http://bm7419.com/article36/ggosg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)站設(shè)計、用戶體驗、網(wǎng)站維護、品牌網(wǎng)站設(shè)計、網(wǎng)站導航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)