wxml 页面
<import src="/pages/lianxi/lianxi.wxml" /> //引入文件
<view style='position:fixed;left:0;top:0;'>
<template is="showToastMyTan">
<text>haha</text>
</template>
</view>
//模板
<template name="showToastCuo">
<view class='showToast-box'>
<view class='showToast-all'>
<view class='showToast-img'>
<image src='../../imgs/towast/icon_1.png'></image>
</view>
<view class=' showToast-text'>
<text>失败</text>
</view>
</view>
</view>
</template>
<template name="showToastMyTan">
<view class='showToast-box'>
<view class='showToast-all'>
<view class='showToast-img'>
<image src='../../imgs/towast/icon_2.png'></image>
</view>
<view class=' showToast-text'>
<text>失败</text>
</view>
</view>
</view>
</template>
/* 弹出框 */
.showToast-box{
100%;
height: 100%;
position: fixed;
z-index: 1000;
}
.showToast-all{
180rpx;
height:220rpx;
background:rgb(90,90,90);
border-radius:13rpx;
overflow:hidden;
box-sizing:border-box;
margin: 0 auto;
margin-top: 50%;
}
.showToast-img{
45%;
height:45%;
margin:0 auto;
margin-top:40rpx;
}
.showToast-img image{
100%;
height:100%;
}
.showToast-text{
padding:5rpx;
100%;
margin-top:5rpx;
color:#fff;
font-size:31rpx;
box-sizing:border-box;
overflow:hidden;
display: flex;
justify-content: center;
align-items: center;
}