原文地址:https://www.npmjs.com/package/vue-layer-mobile
#vue-layer-mobile vue弹出层插件,包含toast loading dialog等浮层控件
demo地址:http://jianghai.wao021.cn/app/layer.html
#安装方法
npm install vue-layer-mobile
npm install vue-layer-mobile@1.0.0
#使用方法
import 'vue-layer-mobile/need/layer.css'
import layer from 'vue-layer-mobile'
Vue.use(layer)
toast: 文字和图标:
this.$layer.toast({
icon: 'icon-check',
content: '提示文字',
time: 2000
})
loading:
this.$layer.loading('加载中...')
dialog:
this.$layer.dialog({
title: ['这是标题', 'background:red;'],
content: '这是内容',
contentClass: 'className',
btn: ['确定']
time: 2000
})
.then(function (res){
let position = res === 0 ? 'left' : 'right'
console.log(position)
})
footer:
this.$layer.footer({
content: '这是内容',
btn: ['取消', '选项1', '选项2']
})
.then(function (res){
var text = res==0 ? '取消' : '选项'+res
console.log(text)
})