lc-actionsheet

用于模拟ios底部弹出操作层的组件

效果

使用方法

<template>
<div class="lc-demo">

<title title="lc-actionsheet"></title>
<category title="弹出选择框"></category>

<div style="align-items: center">
<lc-button text="不带取消按钮" type="normal" @LcButtonClicked="showSheet1 = true" class="mt20"></lc-button>

<lc-button text="点击空白处不关闭" type="normal" @LcButtonClicked="showSheet2 = true" class="mt20"></lc-button>
</div>

<lc-actionsheet
v-model="showSheet1"
:actions="actions1"
cancelText=""
titleText=""
actionColor="#f00"
actionFontSize="40px">
</lc-actionsheet>

<lc-actionsheet
v-model="showSheet2"
:actions="actions2"
:closeOnClickMask="false"
titleText="客服服务时间:工作日09:00-20:00"
cancelColor="#f00"
cancelFontSize="38px">
</lc-actionsheet>

</div>
</template>

<script>
import Light from 'light';
import Title from 'lighting-ui/packages/_mods/title.vue';
import Category from 'lighting-ui/packages/_mods/category.vue';
import LcButton from 'lighting-ui/packages/lc-button';
import LcActionsheet from 'lighting-ui/packages/lc-actionsheet';
const modal = Light.requireModule('modal');

export default {
components: { Title, Category, LcButton, LcActionsheet },
data(){
return {
showSheet1: false,
showSheet2: false,
actions1: [
{
name: '拍照',
method: this.takePhoto
},
{
name: '从相册中选择',
method: this.openAlbum
},
],
actions2: [
{
name: '咨询服务热线:400-888-8888',
method: this.callPhone
},
{
name: '152-2926-7590',
method: this.takeMobile
}
]
}
},
methods: {
takePhoto () {
modal.toast({ message: 'taking photo' });
},

openAlbum () {
modal.toast({ message: 'opening album' });
},

callPhone (action) {
modal.toast({ message: action.name });
},

takeMobile (action) {
modal.toast({ message: action.name });
}
}
};
</script>
<style scoped>
.button { margin-top: 100px; margin-left: 75px; }
.mt20{margin-top: 20px;}
</style>

可配置参数

Prop Type Required Default Description
v-model boolean Y false 展示隐藏
closeOnClickMask boolean N true 点击背景隐藏
cancelText string N 取消 取消
titleText string N 标题 标题
actions array Y [] 内容主题
actionColor string N #0076FF 内容文字颜色
cancelColor string N #0076FF 取消文字颜色
actionFontSize string N 40px 内容文字大小
cancelFontSize string N 40px 取消文字大小