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

vue彈窗消息組件的使用方法

 更新時(shí)間:2020年09月24日 16:52:09   作者:章魚no丸子  
這篇文章主要為大家詳細(xì)介紹了vue彈窗消息組件的使用方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue彈窗消息組件的具體代碼,供大家參考,具體內(nèi)容如下

本來打算寫一個(gè)那種提示完了自動(dòng)消失的彈窗的,但是沒有想好淡入淡出的效果。所以暫時(shí)算是半成品。

練習(xí)代碼如下:

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>ys-alert-component</title>
 <style>
 input {
 border-radius: 5px;
 border: 1px solid #2f9df9;
 background-color: #39befb;
 background: -webkit-gradient(linear, 0 0, 0 100%, from(#39befb),
 to(#2091fc));
 background: -moz-gradient(linear, 0 0, 0 100%, from(#39befb),
 to(#2091fc));
 background: -o-gradient(linear, 0 0, 0 100%, from(#39befb), to(#2091fc));
 background: -ms-gradient(linear, 0 0, 0 100%, from(#39befb), to(#2091fc));
 color: #FFFFFF;
 height: 28px;
 padding: 0 20px;
 cursor: pointer;
 line-height: 28px;
 display: inline-block;
 margin-right: 5px;
 outline: none;
 }
 .ys-alert {
 display: inline-block;
 height: 26px;
 padding: 8px 25px;
 min-width: 200px;
 border-radius: 5px;
 box-shadow: 0 4px 12px rgba(0,0,0,.5);
 background: #b8d2f3;
 margin: 50px;
 }
 .icon {
 float: left;
 width: 26px;
 height: 26px;
 border: 3px solid #fff;
 border-radius: 50%;
 font-size: 16px;
 line-height: 20px;
 font-weight: bold;
 text-align: center;
 color: #fff;
 box-sizing: border-box;
 margin-right: 8px;
 }
 .content {
 float: left;
 line-height: 26px;
 font-size: 15px;
 color: #fff;
 }
 /*成功的樣式*/
 .success {
 background: #9bdda7;
 }
 /*失敗的樣式*/
 .error {
 background: #f7d13b;
 }
 /*警告樣式*/
 .warning {
 background: #e98c97;
 } 
 </style>
 <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
 <div id="app">
 <input type="button" value="呼喚默認(rèn)的按鈕" @click="alertShow('info')">
 <input type="button" value="呼喚成功的按鈕" @click="alertShow('success')">
 <input type="button" value="呼喚失敗的按鈕" @click="alertShow('error')">
 <input type="button" value="呼喚警告的按鈕" @click="alertShow('warning')">
 <input type="button" value="呼喚美美噠博客" @click="alertShow('yuki')">
 <ys-alert-component 
 icon-bar="O" 
 type="info" 
 v-if="info" 
 alert-content="我是默認(rèn)的按鈕喲">
 </ys-alert-component>
 <ys-alert-component 
 icon-bar="V" 
 type="success" 
 v-if="success" 
 alert-content="我是成功的按鈕喲"> 
 </ys-alert-component>
 <ys-alert-component 
 icon-bar="X" 
 type="error" 
 v-if="error" 
 alert-content="我是失敗的按鈕喲">
 </ys-alert-component>
 <ys-alert-component 
 icon-bar="!" 
 type="waring" 
 v-if="warning" 
 alert-content="我是警告的按鈕喲">
 </ys-alert-component>
 <ys-alert-component 
 icon-bar="E" 
 type="" 
 v-if="yuki" 
 alert-content="我是灰色定制的按鈕喲" 
 style="background-color: #ccc; color: #fff;">
 <div slot="alert-content">
 <span>章魚不丸子</span>
 <a  rel="external nofollow" >http://www.yuki.kim</a>
 </div>
 </ys-alert-component>
 </div>
 <script>
 /*
 props:
 type:
  info: 默認(rèn)
  success: 成功
  error: 失敗
  warning:警告
 iconBar: 字符串,我沒有圖標(biāo),就用字母寫的。很low...
 alertContent: 定制提醒的內(nèi)容
 hideIcon: 隱藏或者顯示丑丑的圖標(biāo)
 slot:
 alert-content: 定制提醒信息內(nèi)容及icon整套模板

 methods:
 無,沒有寫方法

 */
 Vue.component("ys-alert-component", {
 props: {
 iconBar: {
  type: String,
  default: ""
 },
 alertContent: {
  type: String,
  default: "請(qǐng)定制提醒內(nèi)容"
 },
 hideIcon: {
  type: Boolean,
  default: false
 },
 type: {
  type: String,
  default: ""
 }
 },
 template:`
 <div class="ys-alert" :class="type">
  <slot name="alert-content">
  <div class="icon" >{{ iconBar }}</div>
  <div class="content">
  {{ alertContent }}
  </div>
  </slot>
 </div>`

 })


 var vm = new Vue({
 el: "#app",
 data: {
 info: false,
 error: false,
 success: false,
 warning: false,
 yuki: false
 },
 methods: {
 alertShow (type) {
  switch (type) {
  case "info" :
  this.info = !this.info;
  //setTimeout("vm.info = !vm.info", 2000);
  break;
  case "error" :
  this.error = !this.error;
  //setTimeout("vm.error = !vm.error", 2000);
  break;
  case "success" :
  this.success = !this.success;
  //setTimeout("vm.success = !vm.success", 2000);
  break;
  case "warning" :
  this.warning = !this.warning;
  //setTimeout("vm.warning = !vm.warning", 2000);
  break;
  default:
  this.yuki = !this.yuki;
  //setTimeout("vm.yuki = !vm.yuki", 2000);
  }
 }
 }
 })
 </script>
</body>
</html>

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

相關(guān)文章

  • 在vue中使用G2圖表的示例代碼

    在vue中使用G2圖表的示例代碼

    這篇文章主要介紹了在vue中使用G2圖表的示例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2019-03-03
  • 如何去除vue項(xiàng)目中的#及其ie9兼容性

    如何去除vue項(xiàng)目中的#及其ie9兼容性

    本篇文章主要介紹了如何去除vue項(xiàng)目中的#及其ie9兼容性,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-01-01
  • Vue實(shí)現(xiàn)固定定位圖標(biāo)滑動(dòng)隱藏效果

    Vue實(shí)現(xiàn)固定定位圖標(biāo)滑動(dòng)隱藏效果

    移動(dòng)端頁(yè)面,有時(shí)候會(huì)出現(xiàn)一些固定定位在底部圖標(biāo),比如購(gòu)物車等。這篇文章主要介紹了Vue制作固定定位圖標(biāo)滑動(dòng)隱藏效果,需要的朋友可以參考下
    2019-05-05
  • 詳解Vue-Router源碼分析路由實(shí)現(xiàn)原理

    詳解Vue-Router源碼分析路由實(shí)現(xiàn)原理

    這篇文章主要介紹了Vue-Router源碼分析路由實(shí)現(xiàn)原理,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • Vue2使用TailwindCSS方法及遇到問題小結(jié)

    Vue2使用TailwindCSS方法及遇到問題小結(jié)

    Tailwind CSS是一個(gè)全新的、可定制的CSS框架,它提供了一系列的CSS類,用于構(gòu)建現(xiàn)代化的Web界面,這篇文章主要介紹了Vue2使用TailwindCSS方法及遇到問題小結(jié),需要的朋友可以參考下
    2024-03-03
  • vue中@keyup.enter失效問題及解決

    vue中@keyup.enter失效問題及解決

    這篇文章主要介紹了vue中@keyup.enter失效問題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • Vue使用Swiper封裝輪播圖組件的方法詳解

    Vue使用Swiper封裝輪播圖組件的方法詳解

    Swiper是一個(gè)很常用的用于實(shí)現(xiàn)各種滑動(dòng)效果的插件,PC端和移動(dòng)端都能很好的適配。本文將利用Swiper實(shí)現(xiàn)封裝輪播圖組件,感興趣的可以了解一下
    2022-09-09
  • vue3+element-plus?Dialog對(duì)話框的使用與setup?寫法的用法

    vue3+element-plus?Dialog對(duì)話框的使用與setup?寫法的用法

    這篇文章主要介紹了vue3+element-plus?Dialog對(duì)話框的使用?與?setup?寫法的使用,本文通過兩種方式結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-04-04
  • 在vue中讀取本地Json文件的方法

    在vue中讀取本地Json文件的方法

    今天小編就為大家分享一篇在vue中讀取本地Json文件的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • Vue路由跳轉(zhuǎn)問題記錄詳解

    Vue路由跳轉(zhuǎn)問題記錄詳解

    本篇文章主要介紹了Vue路由跳轉(zhuǎn)問題記錄詳解,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-06-06

最新評(píng)論

中阳县| 东莞市| 邯郸市| 静海县| 九台市| 鹤峰县| 乌审旗| 左贡县| 四子王旗| 随州市| 广德县| 肇东市| 宁都县| 泽库县| 上杭县| 洛隆县| 沈丘县| 丹寨县| 沂源县| 贵溪市| 镇赉县| 内黄县| 阿图什市| 益阳市| 岗巴县| 浮梁县| 甘德县| 洱源县| 娱乐| 肥东县| 奉化市| 永康市| 海林市| 九台市| 遵化市| 奎屯市| 海兴县| 普兰店市| 鄂温| 灵丘县| 陆河县|