亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術(shù)文章
文章詳情頁

vue實現(xiàn)導(dǎo)航菜單和編輯文本的示例代碼

瀏覽:9日期:2023-01-09 11:13:37

導(dǎo)航菜單實例

<div id='main'> <!-- 激活的菜單樣式為 active 類 --> <!-- 為了阻止鏈接在點擊時跳轉(zhuǎn),我們使用了 'prevent' 修飾符 (preventDefault 的簡稱)。 --> <nav v-bind: v-on:click.prevent> <!-- 當菜單上的鏈接被點擊時,我們調(diào)用了 makeActive 方法, 該方法在 Vue 實例中創(chuàng)建。 --> <a href='http://www.aoyou183.cn/bcjs/11364.html#' rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='external nofollow' v-on:click='makeActive(’home’)'>Home</a> <a href='http://www.aoyou183.cn/bcjs/11364.html#' rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='external nofollow' v-on:click='makeActive(’projects’)'>Projects</a> <a href='http://www.aoyou183.cn/bcjs/11364.html#' rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='external nofollow' v-on:click='makeActive(’services’)'>Services</a> <a href='http://www.aoyou183.cn/bcjs/11364.html#' rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='external nofollow' v-on:click='makeActive(’contact’)'>Contact</a> </nav> <!-- 以下 'active' 變量會根據(jù)當前選中的值來自動變換 --> <p>您選擇了 <b>{{active}} 菜單</b></p></div> <script>// 創(chuàng)建一個新的 Vue 實例var demo = new Vue({ // DOM 元素,掛載視圖模型 el: ’#main’, // 定義屬性,并設(shè)置初始值 data: { active: ’home’ }, // 點擊菜單使用的函數(shù) methods: { makeActive: function(item){ // 模型改變,視圖會自動更新 this.active = item; } }});</script>

效果如下:

vue實現(xiàn)導(dǎo)航菜單和編輯文本的示例代碼

編輯文本實例

<!-- v-cloak 隱藏未編譯的變量,直到 Vue 實例準備就緒。 --><!-- 元素點擊后 hideTooltp() 方法被調(diào)用 --> <div v-cloak v-on:click='hideTooltip'> <!-- 這是一個提示框 v-on:click.stop 是一個點擊事件處理器,stop 修飾符用于阻止事件傳遞 v-if 用來判斷 show_tooltip 為 true 時才顯示 --> <div v-on:click.stop v-if='show_tooltip'> <!-- v-model 綁定了文本域的內(nèi)容 在文本域內(nèi)容改變時,對應(yīng)的變量也會實時改變 --> <input type='text' v-model='text_content' /> </div> <!-- 點擊后調(diào)用 'toggleTooltip' 方法并阻止事件傳遞 --> <!-- 'text_content' 變量根據(jù)文本域內(nèi)容的變化而變化 --> <p v-on:click.stop='toggleTooltip'>{{text_content}}</p> </div> <script>var demo = new Vue({ el: ’#main’, data: { show_tooltip: false, text_content: ’點我,并編輯內(nèi)容。’ }, methods: { hideTooltip: function(){ // 在模型改變時,視圖也會自動更新 this.show_tooltip = false; }, toggleTooltip: function(){ this.show_tooltip = !this.show_tooltip; } }})</script>

效果如下:

vue實現(xiàn)導(dǎo)航菜單和編輯文本的示例代碼

以上就是vue實現(xiàn)導(dǎo)航菜單和編輯文本的示例代碼的詳細內(nèi)容,更多關(guān)于vue 導(dǎo)航菜單 編輯文本的資料請關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 欧美日韩色视频 | 国产精品国产亚洲精品不卡 | 日本乱人伦片中文字幕三区 | 国产真实搭讪系列 | 国产精品福利片免费看 | 91久久亚洲国产成人精品性色 | 欧美二区三区 | 成人国产一区 | 亚洲第一综合 | 中文字幕日韩视频 | 久久精品无码一区二区三区 | 日韩性生活片 | 久久视频精品36线视频在线观看 | 老妇综合久久香蕉蜜桃 | 亚洲精品久久久久中文字小说 | 在线观看亚洲精品国产 | 99久久免费精品高清特色大片 | 同性男男黄h片在线播放免费 | 在线免费观看国产视频 | 91精品国产一区二区三区左线 | 成人精品视频在线观看 | 国产精品吹潮香蕉在线观看 | 成人在线播放 | 国产精品成人久久久久 | 色综合久久丁香婷婷 | 九九精品免费视频 | 一级黄色片免费播放 | 亚洲视频1区 | 国产美女一区二区在线观看 | 国产亚洲人成网站在线观看不卡 | 国产成人精品在线 | 国产酒店视频 | 狠狠干影视| 一级毛片免费一级直接观看 | 国产在线观看99 | 99久热只有精品视频免费观看17 | 永久免费在线 | 中文字幕日韩理论在线 | 国产黄色在线视频 | 欧美真人毛片动作视频 | 欧美在线性视频 |