<template>
<gracePage :customHeader="false">
<!-- 页面主体 -->
<view slot="gBody" class="grace-body">
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">组件演示</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view style="line-height:200rpx; text-align:center;" @tap="showActionSheet">点击这里打开操作表 (:</view>
<graceActionSheet title="请选择所在班级" @cancel="cancel" :items="actionSheetItems" ref="graceActionSheet" @selected="selected"></graceActionSheet>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/components/gracePage.vue";
import graceActionSheet from '../../graceUI/components/graceActionSheet.vue';
export default {
data() {
return {
actionSheetItems : ['一年一班','一年二班','一年三班']
}
},
onLoad: function () {},
methods:{
selected : function(e){
uni.showToast({ title:"您选择了 : " + this.actionSheetItems[e], icon:"none" });
//this.$refs.graceActionSheet.close();
},
cancel : function(){
uni.showToast({ title:"您点击了取消", icon:"none" });
},
showActionSheet:function(){
this.$refs.graceActionSheet.show();
}
},
components:{
gracePage, graceActionSheet
}
}
</script>
<style>
</style>
<template>
<gracePage :customHeader="false">
<!-- 页面主体 -->
<view slot="gBody" class="grace-body">
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">组件演示</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<text style="line-height:200rpx; text-align:center;" class="grace-text-small" @tap="showActionSheet">点击这里打开操作表 (:</text>
<graceActionSheet title="请选择所在班级" @cancel="cancel" :items="actionSheetItems" ref="graceActionSheet" @selected="selected"></graceActionSheet>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/weexComponents/gracePage.nvue";
import graceActionSheet from '../../graceUI/weexComponents/graceActionSheet.nvue';
export default {
data() {
return {
actionSheetItems : ['一年一班','一年二班','一年三班']
}
},
onLoad: function () {},
methods:{
selected : function(e){
uni.showToast({ title:"您选择了 : " + this.actionSheetItems[e], icon:"none" });
//this.$refs.graceActionSheet.close();
},
cancel : function(){
uni.showToast({ title:"您点击了取消", icon:"none" });
},
showActionSheet:function(){
this.$refs.graceActionSheet.show();
}
},
components:{
gracePage, graceActionSheet
}
}
</script>
<style>
</style>
.wxml
<gracePage customHeader="{{false}}">
<!-- 页面主体 -->
<view slot="gBody" class="grace-body">
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">组件演示</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view style="line-height:200rpx; text-align:center;" bindtap="showActionSheet">点击这里打开操作表 (:</view>
<graceActionSheet title="请选择所在班级" bind:cancel="cancel" items="{{actionSheetItems}}" id="graceActionSheet" bind:selected="selected"></graceActionSheet>
</view>
</gracePage>.js
Page({
data: {
actionSheetItems : ['一年一班','一年二班','一年三班']
},
onLoad : function(){
},
selected : function(e){
e = e.detail;
wx.showToast({ title:"您选择了 : " + this.data.actionSheetItems[e], icon:"none" });
},
cancel : function(){
wx.showToast({ title:"您点击了取消", icon:"none" });
},
showActionSheet:function(){
this.selectComponent('#graceActionSheet').show();
}
}).json
{
"usingComponents": {
"gracePage": "../../graceUI/components/gracePage",
"graceActionSheet": "../../graceUI/components/graceActionSheet"
}
}