| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view class="coin-list layout-page">
- <view :style="{height:taskHeight+'px'}"></view>
- <view>
- <van-search background="transparent" :action-text="$t('common.cancelButtonText')" v-model="filterName" show-action @cancel="$emit('close')" @search="search" :placeholder="$t('assets.b5')" />
- </view>
- <view class="layout-main">
- <view
- v-for="item in showList"
- :key="item.fiat"
- class="p-md align-center justify-between d-flex link-active m-md bg-panel-4 rounded box-shadow"
- @click="$emit('input',item.fiat);$emit('close')"
- >
- <view>{{item.fiat}}</view>
- <!-- <view class="color-light">{{item.country}}</view> -->
- </view>
- </view>
- </view>
- </template>
- <script>
- import Wallet from "@/api/wallet";
- export default {
- props: {
- value: {
- default: "",
- type: String,
- required: false,
- },
- },
- data() {
- return {
- filterName: "",
- fiatList: [],
- taskHeight:0
- };
- },
- computed: {
- showList() {
- return this.fiatList.filter((item) => this.isShow(item.fiat));
- },
- },
- methods: {
- getCoinList() {
- Wallet.fundFiat()
- .then((res) => {
- console.log(res)
- this.fiatList = res.data;
- if (!this.value) {
- this.$emit("input", this.fiatList[0].fiat);
- }
- })
- .catch(() => {});
- },
- isShow(str) {
- return (
- str.toLocaleLowerCase().indexOf(this.filterName.toLocaleLowerCase()) !=
- -1
- );
- },
- getTaskHeight(){
- uni.getSystemInfo({
- success:(obj)=>{
- this.taskHeight = obj.statusBarHeight
- }
- })
- },
- search(e){
- this.filterName = e.detail
- }
- },
- created() {
- this.getTaskHeight()
- this.getCoinList();
- },
- };
- </script>
- <style lang="scss" scoped>
- .coin-list {
- position: fixed;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- z-index: 9;
- animation: coinList 0.3s;
- }
- @keyframes coinList {
- from {
- transform: translateY(100%);
- }
- to {
- transform: translateY(0);
- }
- }
- </style>
|