| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <view class="select">
- <view class="title p-30 row-justify-sb">
- <view class="icon"></view>
- <text class="size-30 sys-weight-600">{{title}}</text>
- <view class="icon">
- <uni-icons :animation="animationData" class="dropdown-icon" type="closeempty" size="16"
- color="#666"></uni-icons>
- </view>
- </view>
- <view class="select">
- <scroll-view scroll-y="true" class="scroll-Y select">
- <view id="demo1" class="scroll-view-item" :class="item.id === current?'':'active'"
- v-for="(item,index) in localData" @click="onSelect(index)">
- <text class="size-28">{{item[itemText]}}</text>
- </view>
- </scroll-view>
- </view>
- <EnButton :is_fixed="false" text="确认" @onSubmit="setAffirm(true)" @onLeftSubmit="setAffirm(false)"></EnButton>
- </view>
- </template>
- <script>
- import EnButton from "@/components/en-utils/en-button/en-button.vue";
- export default {
- name: 'peak_chart',
- props: {
- title: {
- type: String,
- default: '选择'
- },
- localData: {
- default: []
- },
- itemKey: {
- type: String,
- default: 'id'
- },
- itemText: {
- type: String,
- default: 'name'
- },
- value: {
- default: ''
- }
- },
- components: {
- EnButton
- },
- data() {
- return {
- current: 3,
- };
- },
- watch: {
- 'value': function() {
- if (this.current !== this.value) {
- this.current = this.value
- }
- }
- },
- methods: {
- setAffirm(type){
- this.$emit('setAffirm',type)
- },
- onSelect(index) {
- this.$emit('onChange', index)
- this.$emit('input', this.localData[index][this.itemKey])
- }
- }
- }
- </script>
- <style lang="scss">
- .select {
- height: 800rpx;
- }
- .icon {
- width: 40rpx;
- text-align: right;
- }
- .scroll-view-item {
- height: 90rpx;
- line-height: 90rpx;
- text-align: center;
- background: rgba(15, 177, 96, 0.1);
- border-radius: 10rpx;
- color: #0FB160;
- border: 1rpx solid #0FB160;
- margin: 16rpx 30rpx;
- }
- .active {
- border: none;
- color: #333333;
- background: #F7F9FE;
- }
- </style>
|