最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue實(shí)現(xiàn)簡(jiǎn)易選項(xiàng)卡功能

 更新時(shí)間:2022年06月24日 16:11:05   作者:顧舟  
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)簡(jiǎn)易選項(xiàng)卡功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue實(shí)現(xiàn)簡(jiǎn)易選項(xiàng)卡功能的具體代碼,供大家參考,具體內(nèi)容如下

1. 效果:

1. 實(shí)現(xiàn)發(fā)布評(píng)論功能

2. 實(shí)現(xiàn)評(píng)論列表的展示

3. 使用標(biāo)簽頁(yè)切換的方式來(lái)實(shí)現(xiàn)

4. 高亮顯示當(dāng)前標(biāo)簽頁(yè)欄對(duì)應(yīng)的導(dǎo)航

2.HTML

<div id="app">
? ? ? ? <p>
? ? ? ? ? ? <button @click="tab(0)" :class="current===0?'active':''">評(píng)論管理</button>
? ? ? ? ? ? <button @click="tab(1)" :class="current===1?'active':''">發(fā)布評(píng)論</button>
? ? ? ? </p>
? ? ? ? <div class="box2" v-show="current===0">
? ? ? ? ? ? <div v-for="item in list">
? ? ? ? ? ? ? ? <p>評(píng)論人:{{item.username}}</p>
? ? ? ? ? ? ? ? <p>評(píng)論時(shí)間:{{item.time}}</p>
? ? ? ? ? ? ? ? <p>評(píng)論內(nèi)容:{{item.content}}</p>
? ? ? ? ? ? </div>
? ? ? ? </div>
? ? ? ? <div class="box1" v-show="current===1">
? ? ? ? ? ? <input v-model="username" type="text" placeholder="昵稱"><br>
? ? ? ? ? ? <input v-model="content" type="text" placeholder="評(píng)論內(nèi)容"><br>
? ? ? ? ? ? <button @click="submit">立即提交</button>
? ? ? ? </div>
</div>

3.CSS

<style>
? ? ? ? #app div {
? ? ? ? ? ? width: 600px;
? ? ? ? ? ? font-size: 14px;
? ? ? ? ? ? box-sizing: border-box;
? ? ? ? }
?
? ? ? ? .box1 {
? ? ? ? ? ? height: 200px;
? ? ? ? ? ? padding: 20px 0 0 10px;
? ? ? ? ? ? background: #eee;
? ? ? ? }
?
? ? ? ? .box2>div {
? ? ? ? ? ? height: 200px;
? ? ? ? ? ? padding: 20px 0 0 10px;
? ? ? ? ? ? background: #eee;
? ? ? ? ? ? margin-bottom: 10px;
? ? ? ? }
?
? ? ? ? p button {
? ? ? ? ? ? width: 100px;
? ? ? ? ? ? height: 35px;
? ? ? ? ? ? border: none;
? ? ? ? ? ? background: #e1e1e1;
? ? ? ? }
?
? ? ? ? p button.active {
? ? ? ? ? ? background: blue;
? ? ? ? ? ? color: #fff;
? ? ? ? }
?
? ? ? ? .box1 input {
? ? ? ? ? ? width: 350px;
? ? ? ? ? ? height: 35px;
? ? ? ? ? ? outline: none;
? ? ? ? ? ? border: 1px solid #ccc;
? ? ? ? ? ? margin-bottom: 10px;
? ? ? ? ? ? border-radius: 5px;
? ? ? ? ? ? box-sizing: border-box;
? ? ? ? }
?
? ? ? ? .box1 button {
? ? ? ? ? ? width: 80px;
? ? ? ? ? ? height: 35px;
? ? ? ? ? ? border: none;
? ? ? ? ? ? border-radius: 5px;
? ? ? ? ? ? background: #e1e1e1;
? ? ? ? }
</style>

4.引入vue.js文件

<script src="vue.js"></script>

5.實(shí)現(xiàn)發(fā)布評(píng)論選項(xiàng)卡功能

// 創(chuàng)建Vue的實(shí)例化對(duì)象
? ? new Vue({
? ? ? ? data: {
? ? ? ? ? ? // 控制選項(xiàng)卡切換
? ? ? ? ? ? current: 1,
? ? ? ? ? ? // 與輸入框進(jìn)行數(shù)據(jù)綁定
? ? ? ? ? ? username: '',
? ? ? ? ? ? content: '',
? ? ? ? ? ? // 創(chuàng)建評(píng)論管理列表數(shù)據(jù)
? ? ? ? ? ? list: []
? ? ? ? },
? ? ? ? methods: {
? ? ? ? ? ? // 點(diǎn)擊提交按鈕
? ? ? ? ? ? submit() {
? ? ? ? ? ? ? ? // 創(chuàng)建當(dāng)前時(shí)間
? ? ? ? ? ? ? ? let date = new Date();
? ? ? ? ? ? ? ? let year = date.getFullYear();
? ? ? ? ? ? ? ? let mon = date.getMonth() + 1;
? ? ? ? ? ? ? ? let day = date.getDate();
? ? ? ? ? ? ? ? let time = year + "-" + mon + '-' + day;
? ? ? ? ? ? ? ? // 創(chuàng)建評(píng)論對(duì)象
? ? ? ? ? ? ? ? const infor = {
? ? ? ? ? ? ? ? ? ? username: this.username,
? ? ? ? ? ? ? ? ? ? content: this.content,
? ? ? ? ? ? ? ? ? ? time
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? // 將評(píng)論對(duì)象追加到評(píng)論管理的列表末尾
? ? ? ? ? ? ? ? this.list.push(infor);
? ? ? ? ? ? ? ? //重置input輸入框的內(nèi)容
? ? ? ? ? ? ? ? this.username = '';
? ? ? ? ? ? ? ? this.content = "";
? ? ? ? ? ? },
? ? ? ? ? ? // 點(diǎn)擊評(píng)論管理按鈕、發(fā)布評(píng)論按鈕(實(shí)現(xiàn)選項(xiàng)卡)
? ? ? ? ? ? tab(index) {
? ? ? ? ? ? ? ? this.current = index;
? ? ? ? ? ? }
? ? ? ? }
? ? }).$mount("#app");

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue讀取本地靜態(tài).md并側(cè)邊欄導(dǎo)航跳轉(zhuǎn)、展示.md文件的操作方法

    Vue讀取本地靜態(tài).md并側(cè)邊欄導(dǎo)航跳轉(zhuǎn)、展示.md文件的操作方法

    這篇文章主要介紹了Vue讀取本地靜態(tài).md并側(cè)邊欄導(dǎo)航跳轉(zhuǎn)、展示.md文件,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-08-08
  • vue 微信掃碼登錄(自定義樣式)

    vue 微信掃碼登錄(自定義樣式)

    這篇文章主要介紹了vue 微信掃碼登錄(自定義樣式),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • 如何使用Vue3的onMounted鉤子函數(shù)及vue3中onMounted的用法詳解

    如何使用Vue3的onMounted鉤子函數(shù)及vue3中onMounted的用法詳解

    本文詳細(xì)介紹了Vue3中的`onMounted`鉤子函數(shù)的前世今生,包括其在Vue2中的前身`mounted`鉤子,以及Vue3中使用Composition?API的`onMounted`鉤子的用法,文章涵蓋了`onMounted`的多種用法,感興趣的朋友跟隨小編一起看看吧
    2024-11-11
  • vuex中mapState思想應(yīng)用

    vuex中mapState思想應(yīng)用

    這篇文章主要分享vuex中mapState思想及應(yīng)用,在需求開發(fā)過(guò)程中,有的接口返回的結(jié)果中有很多字段需要展示到頁(yè)面上。通??梢詫⑦@些字段在.vue文件中封裝為計(jì)算屬性,或者重新將對(duì)應(yīng)字段賦值到 data 中的字段來(lái)達(dá)到便于使用的目的,具體內(nèi)容,我們一起來(lái)看下面文章內(nèi)容吧
    2021-10-10
  • VUE 實(shí)現(xiàn)一個(gè)簡(jiǎn)易老虎機(jī)的項(xiàng)目實(shí)踐

    VUE 實(shí)現(xiàn)一個(gè)簡(jiǎn)易老虎機(jī)的項(xiàng)目實(shí)踐

    老虎機(jī)在很多地方都可以見到,可以設(shè)置中獎(jiǎng)位置,以及中獎(jiǎng)回調(diào),本文主要介紹了VUE 實(shí)現(xiàn)一個(gè)簡(jiǎn)易老虎機(jī)的項(xiàng)目實(shí)踐,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-04-04
  • Vue-Router路由守衛(wèi)詳?shù)募?xì)用法教程

    Vue-Router路由守衛(wèi)詳?shù)募?xì)用法教程

    在Vue.js應(yīng)用中,Vue-Router是一個(gè)非常重要的插件,它允許我們實(shí)現(xiàn)頁(yè)面間的導(dǎo)航,然而,僅僅實(shí)現(xiàn)導(dǎo)航是不夠的,我們還需要在導(dǎo)航的不同階段進(jìn)行各種操作,本文將結(jié)合實(shí)際案例,詳細(xì)介紹Vue-Router路由守衛(wèi)的用法,需要的朋友可以參考下
    2024-12-12
  • vue2+electron項(xiàng)目搭建過(guò)程

    vue2+electron項(xiàng)目搭建過(guò)程

    文章介紹了如何使用Vue CLI 2搭建Vue項(xiàng)目,并添加Electron插件vue-cli-plugin-electron-builder來(lái)創(chuàng)建一個(gè)Vue+Electron項(xiàng)目,文章還提供了啟動(dòng)和打包項(xiàng)目的方法,并提示了下載國(guó)內(nèi)網(wǎng)較慢的文件時(shí)可以先注釋掉代碼進(jìn)行調(diào)試,感興趣的朋友一起看看吧
    2025-01-01
  • Vue獲取表單數(shù)據(jù)的方法

    Vue獲取表單數(shù)據(jù)的方法

    這篇文章主要為大家介紹了Vue獲取表單數(shù)據(jù)的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來(lái)幫助
    2021-12-12
  • 關(guān)于vue3中setup函數(shù)的使用

    關(guān)于vue3中setup函數(shù)的使用

    這篇文章主要介紹了關(guān)于vue3中setup函數(shù)的使用,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • 基于vue實(shí)現(xiàn)循環(huán)滾動(dòng)列表功能

    基于vue實(shí)現(xiàn)循環(huán)滾動(dòng)列表功能

    這篇文章給大家介紹基于vue實(shí)現(xiàn)循環(huán)滾動(dòng)列表功能,給大家介紹了該組件的用法,通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友參考下吧
    2021-09-09

最新評(píng)論

新龙县| 东阳市| 青阳县| 赞皇县| 岢岚县| 阿城市| 汕头市| 丹寨县| 岑巩县| 息烽县| 万宁市| 边坝县| 灌阳县| 宝兴县| 沅陵县| 岑巩县| 来凤县| 荣昌县| 岳西县| 安徽省| 诸城市| 张北县| 泽州县| 探索| 台中市| 且末县| 洛扎县| 建瓯市| 高州市| 霞浦县| 泾川县| 巫山县| 乐亭县| 微山县| 江川县| 常宁市| 宁波市| 玉林市| 阳谷县| 彩票| 长宁县|