123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <template>
- <view class="tm-actionSheet ">
- <tm-poup @change="toogle" ref="pop" v-model="showpop" height="auto" :black="black_tmeme" :bg-color="black_tmeme ? 'grey-darken-6' : 'grey-lighten-4'">
- <view class="tm-actionSheet-title pa-32 pb-32 relative " :class="[black_tmeme ? 'grey-darken-5' : 'white']">
- <view class="text-size-n text-align-center">{{ title }}</view>
- <view class="tm-actionSheet-close rounded flex-center absolute" :class="black_tmeme ? 'grey-darken-4' : 'grey-lighten-3'">
- <tm-icons @click="close" name="icon-times" size="24" :color="black_tmeme ? 'white' : 'grey'"></tm-icons>
- </view>
- </view>
- <view>
- <slot>
- <tm-grouplist shadow="5" round="4">
- <tm-listitem
- :black="black_tmeme"
- @click="onclick(index, item)"
- v-for="(item, index) in actions"
- :key="index"
- :title="item[rangKey]"
- :label="item['label'] ? item['label'] : ''"
- :right-icon="item['rightIcon'] ? item['rightIcon'] : 'icon-angle-right'"
- ></tm-listitem>
- </tm-grouplist>
- </slot>
- </view>
- <view style="height: 50upx"></view>
- </tm-poup>
- </view>
- </template>
- <script>
- import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
- import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
- import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
- import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
- export default {
- components: { tmGrouplist, tmListitem, tmIcons, tmPoup },
- name: 'tm-actionSheet',
- model: {
- prop: 'value',
- event: 'input'
- },
- props: {
- value: {
- type: Boolean,
- default: false
- },
- black: {
- type: Boolean,
- default: null
- },
- title: {
- type: String,
- default: '操作栏'
- },
-
-
- actions: {
- type: Array,
- default: () => {
- return [];
- }
- },
-
- rangKey: {
- type: String,
- default: 'title'
- },
-
- clickClose: {
- type: Boolean,
- default: true
- }
- },
- data() {
- return {
- showpop: false
- };
- },
- mounted() {
- this.showpop = this.value;
- },
- watch: {
- value: function(val) {
- this.showpop = val;
- }
- },
- computed: {
- black_tmeme: function() {
- if (this.black !== null) return this.black;
- return this.$tm.vx.state().tmVuetify.black;
- }
- },
- methods: {
- close() {
- this.$refs.pop.close();
- },
- toogle(e) {
- let t = this;
- if (e) {
- this.$nextTick(function() {
- if (this.showpop != this.value) {
- this.showpop = this.value;
- }
- });
- }
- this.$emit('input', e);
- this.$emit('update:value', e);
- },
- onclick(index, item) {
- if (this.clickClose === true) {
- this.$refs.pop.close();
- this.$emit('change', {
- index: index,
- data: item
- });
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .tm-actionSheet-title {
- .tm-actionSheet-close {
- top: 32upx;
- right: 32upx;
- width: 50upx;
- height: 50upx;
- }
- }
- </style>
|