123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <view class="tm-actionSheetMenu">
- <tm-poup @change="toogle" ref="pop" :black="false" v-model="showpop" height="auto" bg-color="none">
- <view class="ma-32">
- <view class=" round-8 overflow ">
- <tm-button
- :fllowTheme="false"
- :black="black_tmeme"
- font-size="22"
- font-color="grey"
- :theme="black_tmeme ? 'grey-darken-4' : 'white'"
- block
- flat
- >
- {{ title }}
- </tm-button>
- <slot>
- <tm-button
- :fllowTheme="false"
- :black="black_tmeme"
- @click="onclick(index, item)"
- v-for="(item, index) in actions"
- :key="index"
- :item-class="'text-' + color_tmeme"
- :theme="black_tmeme ? 'grey-darken-4' : 'white'"
- block
- flat
- >
- {{ item[rangKey] ? item[rangKey] : item }}
- </tm-button>
- </slot>
- </view>
- <view style="height: 96upx " class="pb-24 pt-16">
- <tm-button :round="8" :fllowTheme="false" :item-class="' text-weight-b'" :black="black_tmeme" @click="close" :theme="black ? 'grey-darken-4' : 'white'" block>
- 取消
- </tm-button>
- </view>
-
- <view style="height: var(--window-bottom);"></view>
-
- </view>
- </tm-poup>
- </view>
- </template>
- <script>
- import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
- import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
- export default {
- components: { tmButton, tmPoup },
- name: 'tm-actionSheetMenu',
- model: {
- prop: 'value',
- event: 'input'
- },
- props: {
- value: {
- type: Boolean,
- default: false
- },
- black: {
- type: Boolean,
- default: null
- },
- title: {
- type: String,
- default: '请操作'
- },
- fontColor: {
- type: String,
- default: 'black'
- },
- actions: {
- type: Array,
- default: () => {
- return [];
- }
- },
-
- rangKey: {
- type: String,
- default: 'title'
- },
-
- clickClose: {
- type: Boolean,
- default: true
- },
-
- fllowTheme: {
- type: Boolean | String,
- default: true
- }
- },
- data() {
- return {
- showpop: false
- };
- },
- mounted() {
- this.showpop = this.value;
- },
- computed: {
- color_tmeme: function() {
- if (this.$tm.vx.state().tmVuetify.color !== null && this.$tm.vx.state().tmVuetify.color && this.fllowTheme) {
- return this.$tm.vx.state().tmVuetify.color;
- }
- return this.fontColor;
- },
- black_tmeme: function() {
- if (this.black !== null) return this.black;
- return this.$tm.vx.state().tmVuetify.black;
- }
- },
- watch: {
- value: function(val) {
- this.showpop = val;
- }
- },
- methods: {
- close() {
- this.$refs.pop.close();
- },
- toogle(e) {
- let t = this;
- if (e) {
- this.$nextTick(function() {
- if (this.dataValue != this.defaultValue) {
- this.dataValue = this.defaultValue;
- }
- });
- }
- this.$emit('input', e);
- this.$emit('update:value', e);
- },
- onclick(index, item) {
- this.$emit('change', { index: index, data: item });
- if (this.clickClose === true) {
- this.$refs.pop.close();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .tm-actionSheetMenu-title {
- .tm-actionSheetMenu-close {
- top: 32upx;
- right: 32upx;
- width: 50upx;
- height: 50upx;
- }
- }
- </style>
|