<template>
<gracePage :customHeader="false">
<!-- 页面主体 -->
<view slot="gBody" class="grace-body">
<view class="btns">
<button type='primary' @tap='showMsg1'>正确操作提醒</button>
<button type='warn' @tap='showMsg2'>错误操作提醒</button>
<button @tap='showMsg3'>普通消息提醒</button>
</view>
<graceHeaderAlert ref="graceHeaderAlert1" background="#9DD26D">
<text class="grace-icons icon-right grace-white grace-h5" style="margin-right:20rpx;"></text>
<text class="grace-h5 grace-white">操作成功</text>
</graceHeaderAlert>
<graceHeaderAlert ref="graceHeaderAlert2" background="#FF0036" :width="500">
<text class="grace-h5 grace-white">X 错误提示</text>
</graceHeaderAlert>
<graceHeaderAlert ref="graceHeaderAlert3">
<text class="grace-icons icon-gonggao grace-green grace-h5" style="margin-right:20rpx;"></text>
<text class="grace-h5 grace-black">普通消息</text>
</graceHeaderAlert>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/components/gracePage.vue";
import graceHeaderAlert from '../../graceUI/components/graceHeaderAlert.vue';
export default {
data() {
return {
}
},
methods:{
showMsg1 : function(){this.$refs.graceHeaderAlert1.open();},
showMsg2: function (){this.$refs.graceHeaderAlert2.open();},
showMsg3: function (){this.$refs.graceHeaderAlert3.open();}
},
components:{
gracePage, graceHeaderAlert
}
}
</script>
<style>
.btns{width:88%; padding:50rpx 6%; margin-top:300px;}
.btns button{width:100%; margin:20rpx 0;}
</style>
<template>
<gracePage :customHeader="false">
<!-- 页面主体 -->
<view slot="gBody" class="grace-body">
<view style="margin-top:300px;">
<button class="btns" type='primary' @tap='showMsg1'>正确操作提醒</button>
<button class="btns" type='warn' @tap='showMsg2'>错误操作提醒</button>
<button class="btns" @tap='showMsg3'>普通消息提醒</button>
</view>
<graceHeaderAlert ref="graceHeaderAlert1" background="#9DD26D">
<text class="grace-icons grace-white grace-h5" style="margin-right:20rpx;"></text>
<text class="grace-h5 grace-white">操作成功</text>
</graceHeaderAlert>
<graceHeaderAlert ref="graceHeaderAlert2" background="#FF0036" :width="500">
<text class="grace-h5 grace-white">X 错误提示</text>
</graceHeaderAlert>
<graceHeaderAlert ref="graceHeaderAlert3">
<text class="grace-icons grace-green grace-h5" style="margin-right:20rpx;"></text>
<text class="grace-h5 grace-black">普通消息</text>
</graceHeaderAlert>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/weexComponents/gracePage.nvue";
import graceHeaderAlert from '../../graceUI/weexComponents/graceHeaderAlert.nvue';
export default {
data() {
return {
}
},
methods:{
showMsg1 : function(){this.$refs.graceHeaderAlert1.open();},
showMsg2: function (){this.$refs.graceHeaderAlert2.open();},
showMsg3: function (){this.$refs.graceHeaderAlert3.open();}
},
components:{
gracePage, graceHeaderAlert
}
}
</script>
<style>
.btns{width:600rpx; margin:10rpx 50rpx;}
</style>
.wxml
<gracePage customHeader="{{false}}">
<!-- 页面主体 -->
<view slot="gBody" class="grace-body">
<view style="margin-top:300rpx;">
<button class="btns" type='primary' bindtap='showMsg1'>正确操作提醒</button>
<button class="btns" type='warn' bindtap='showMsg2'>错误操作提醒</button>
<button class="btns" bindtap='showMsg3'>普通消息提醒</button>
</view>
<graceHeaderAlert id="graceHeaderAlert1" background="#9DD26D">
<text class="grace-icons icon-right grace-white grace-h5" style="margin-right:20rpx;"></text>
<text class="grace-h5 grace-white">操作成功</text>
</graceHeaderAlert>
<graceHeaderAlert id="graceHeaderAlert2" background="#FF0036" width="{{300}}">
<text class="grace-h5 grace-white">X 错误提示</text>
</graceHeaderAlert>
<graceHeaderAlert id="graceHeaderAlert3">
<text class="grace-icons icon-gonggao grace-green grace-h5" style="margin-right:20rpx;"></text>
<text class="grace-h5 grace-black">普通消息</text>
</graceHeaderAlert>
</view>
</gracePage>.wxss
.btns{width:100%; margin:20rpx 0;}.js
Page({
data: {},
showMsg1: function () {
this.selectComponent('#graceHeaderAlert1').open();
},
showMsg2: function () {
this.selectComponent('#graceHeaderAlert2').open();
},
showMsg3: function () {
this.selectComponent('#graceHeaderAlert3').open();
}
}).json
{
"usingComponents": {
"gracePage": "../../graceUI/components/gracePage",
"graceHeaderAlert": "../../graceUI/components/graceHeaderAlert"
}
}