提交 873141ba 编写于 作者: D DCloud_LXH

chore: 处理 warning

上级 a4b9d0a6
<script lang="uts">
export type ItemType = { value : number; name : string }
export type ItemType = { value : number; name : string }
export default {
props: {
title: {
type: String,
default: ''
},
items: {
type: Array as PropType<Array<ItemType>>,
required: true
}
},
data() {
return {
current: 0
}
},
methods: {
// @ts-ignore
_change(e : RadioGroupChangeEvent) {
const selected = this.items.find((item) : boolean => {
return item.name === e.detail.value as string
})
this.current = selected?.value as number
this.$emit('change', this.current)
uni.showToast({
icon: 'none',
title: '当前选中:' + selected?.name,
})
}
}
}
export default {
props: {
title: {
type: String,
default: ''
},
items: {
type: Array as PropType<Array<ItemType>>,
required: true
}
},
data() {
return {
current: 0
}
},
methods: {
// @ts-ignore
_change(e : RadioGroupChangeEvent) {
const selected = this.items.find((item: ItemType) : boolean => {
return item.name === e.detail.value
}) as ItemType | null
if (selected !== null) {
this.current = selected.value
this.$emit('change', this.current)
uni.showToast({
icon: 'none',
title: '当前选中:' + selected.name,
})
}
}
}
}
</script>
<template>
<view class="uni-padding-wrap">
<view class="uni-title uni-common-mt">
<text class="uni-title-text"> {{title}} </text>
</view>
</view>
<view class="uni-list uni-common-pl">
<radio-group @change="_change" class="radio-group">
<radio class="uni-list-cell uni-list-cell-pd radio" v-for="(item, index) in items" :key="item.name"
:class="index < items.length - 1 ? 'uni-list-cell-line' : ''" :value="item.name" :checked="index === current">
{{ item.name }}
</radio>
</radio-group>
</view>
<view class="uni-padding-wrap">
<view class="uni-title uni-common-mt">
<text class="uni-title-text"> {{title}} </text>
</view>
</view>
<view class="uni-list uni-common-pl">
<radio-group @change="_change" class="radio-group">
<radio class="uni-list-cell uni-list-cell-pd radio" v-for="(item, index) in items" :key="item.name"
:class="index < items.length - 1 ? 'uni-list-cell-line' : ''" :value="item.name" :checked="index === current">
{{ item.name }}
</radio>
</radio-group>
</view>
</template>
<style></style>
\ No newline at end of file
<style></style>
......@@ -48,10 +48,6 @@
this.showClearIcon = false
this.$emit('confirm', this.getValue(this.inputClearValue))
},
// @ts-ignore
confirm(e : InputConfirmEvent) {
// this.$emit('confirm', this.getValue(e.detail.value))
},
blur() {
this.showClearIcon = false
},
......@@ -85,8 +81,7 @@
</view>
</view>
<view class="uni-input-wrapper input-wrapper">
<input class="uni-input" :type="inputType" :value="inputClearValue" :placeholder="title" @input="input"
@confirm="confirm" @blur="blur" @focus="focus" />
<input class="uni-input" :type="inputType" :value="inputClearValue" :placeholder="title" @input="input" @blur="blur" @focus="focus" />
<image class="input-wrapper_image" src="/static/icons/clear.png" v-if="showClearIcon" @click="clearIcon">
</image>
</view>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册