install
npm install tk-layer
with main.js
or index.js
add:
import Vue from 'vue';
import {layer} from 'tk-layer'
Vue.prototype.$layer = layer(Vue);
in component
this.$layer.alert("找不到对象!");
{
type: 0, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)
title: '信息',
content: '',
area: 'auto',
offset: 'auto',
icon: -1,
btn: '确定',
time: 0,
shade: true,
yes: '',
cancel: '',
tips: [0,{}],//支持上右下左四个方向,通过1-4进行方向设定,可以设定tips: [1, '#c00']
tipsMore: false,//是否允许多个tips
shadeClose: false,
}
layer.alert(contetn, options, yes);
layer.confirm(content, options, yes, cancel)
layer.msg(contetn, options, end);
layer.tips(content, follow, options);
layer.open(options);
layer.close(id);
layer.closeAll(type);