国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

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

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

導航菜單實例

<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.cgvv.com.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.cgvv.com.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.cgvv.com.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.cgvv.com.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)導航菜單和編輯文本的示例代碼

編輯文本實例

<!-- 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)導航菜單和編輯文本的示例代碼

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

標簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 在线免费国产 | 国产欧美在线观看不卡 | 成年男女免费视频网站播放 | 成人欧美网站免费 | 免费国产成人综合 | 高清不卡毛片 | 国产精品一在线观看 | 日韩一级片在线免费观看 | 国产精品一区久久精品 | 亚洲一区2区三区4区5区 | 香港aa三级久久三级 | 欧美性xxxx极品高清 | 亚洲综合久久久久久中文字幕 | 国产成人免费a在线资源 | 玖玖国产在线 | 中国三级网站 | 国产成人做受免费视频 | 国产日韩欧美在线 | 国产精品亚洲综合天堂夜夜 | 99热热久久这里只有精品166 | 午夜精品久久久久久91 | 亚洲 中文 欧美 日韩 在线人 | 九九视频在线观看视频 | 久草在线观看资源 | 久久精品高清视频 | 欧美亚洲午夜 | 大陆高清自拍 | 亚洲精品久久99久久 | 中文字幕一区二区三区有限公司 | 欧美精品aaa久久久影院 | 久久午夜鲁丝片午夜精品 | 一本久道综合久久精品 | 特及毛片| 免费高清特级毛片 | 黄色毛片国产 | 国产精品久久久久久久久久免费 | 国产女人毛片 | 韩国毛片基地 | 欧美成人片在线 | 一本久久a久久精品亚洲 | 亚洲国产成+人+综合 |