vue項(xiàng)目中使用vue-layer彈框插件的方法
vue-layer彈框插件
安裝
npm i --save vue-layer
引用
import layer from ’vue-layer’Vue.prototype.$layer = layer(Vue);
參數(shù)說(shuō)明
{ type: 0, //0(信息框,默認(rèn))1(頁(yè)面層)2(iframe層)3(加載層)4(tips層) title: ’信息’, content: ’’, area: ’auto’, offset: ’auto’, icon: -1, btn: ’確定’, time: 0, shade: true,//是否顯示遮罩 yes: ’’, cancel: ’’, tips: [0,{}],//支持上右下左四個(gè)方向,通過(guò)1-4進(jìn)行方向設(shè)定,可以設(shè)定tips: [1, ’#c00’] tipsMore: false,//是否允許多個(gè)tips shadeClose: true,//點(diǎn)擊遮罩是否關(guān)閉}
方法
layer.alert(content, [options, yes]); // options和yes可以省略, 如果您不愿意寫(xiě)options,則可以直接寫(xiě)確定按鈕的函數(shù),即yes // content 可以為htmllayer.confirm(content, [options, yes, cancel]); // options,yes和cancel可以省略, 如果您不愿意寫(xiě)options,則可以直接寫(xiě)確定按鈕的函數(shù),即yes,或者覆蓋默認(rèn)的cancel方法。PS:yes和cancel方法不能互換 //content 可以為htmllayer.msg(content, [options, end]); // options和end可以省略, 如果您不愿意寫(xiě)options,則可以直接寫(xiě)時(shí)間到期的回調(diào)即可,即end方法 // 默認(rèn)msg的關(guān)閉時(shí)間為1.5秒 // content 可以為htmllayer.tips(content, follow, options);//content 可以為html//follow對(duì)css選擇器,用來(lái)定位目標(biāo)layer.iframe({ content: { content: componentName, //傳遞的組件對(duì)象 parent: this,//當(dāng)前的vue對(duì)象 data:{}//props }, area:[’800px’,’600px’], title: ’title’});// data參數(shù)可認(rèn)為是componentName的props,同時(shí) 該方法會(huì)自動(dòng)添加一個(gè)key為layerid的值, 該值為創(chuàng)建層的id, 可以直接用來(lái)關(guān)閉該層// options參數(shù)直接寫(xiě)到j(luò)son里即可,比如title
layer.open(options);
layer.close(id);
layer.closeAll(type);
其它說(shuō)明
該包的css都為vl-notice開(kāi)頭, 需要重寫(xiě)css樣式,覆蓋即可
總結(jié)
到此這篇關(guān)于vue項(xiàng)目中使用vue-layer彈框插件的方法的文章就介紹到這了,更多相關(guān)vue vue-layer彈框插件內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. ASP.NET MVC實(shí)現(xiàn)城市或車(chē)型三級(jí)聯(lián)動(dòng)2. IntelliJ IDEA設(shè)置條件斷點(diǎn)的方法步驟3. PHP數(shù)組array類(lèi)常見(jiàn)操作示例4. 淺談Java HttpURLConnection請(qǐng)求方式5. 永久解決 Intellij idea 報(bào)錯(cuò):Error :java 不支持發(fā)行版本5的問(wèn)題6. Eclipse XSD 生成枚舉類(lèi)型的Schema的實(shí)例詳解7. PHP中常用的函數(shù)庫(kù)和一些小技巧8. JavaScript內(nèi)置對(duì)象之Array的使用小結(jié)9. Java正則表達(dá)式實(shí)現(xiàn)經(jīng)緯度的合法性操作10. python實(shí)現(xiàn)ftp文件傳輸系統(tǒng)(案例分析)
