feat:符号选择
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
<template>
|
||||
<view class="y-f" style="height: 55vh">
|
||||
<view class="weight">
|
||||
<view class="symbol">
|
||||
<uni-data-select
|
||||
v-if="showSymbol"
|
||||
v-model="symbol"
|
||||
:localdata="range"
|
||||
placeholder="请选择符号"
|
||||
:clear="false"
|
||||
></uni-data-select>
|
||||
</view>
|
||||
<view class="weight-data">{{ nums }}</view>
|
||||
</view>
|
||||
|
||||
@@ -35,6 +44,10 @@ const props = defineProps({
|
||||
numKeyboardParam: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
},
|
||||
showSymbol: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -43,6 +56,13 @@ const props = defineProps({
|
||||
|
||||
// Data
|
||||
const nums = ref('')
|
||||
|
||||
const symbol = ref('')
|
||||
|
||||
const range = ref([
|
||||
{ value: '=', text: '=' },
|
||||
{ value: '<', text: '<' }
|
||||
])
|
||||
const numbers = ref([
|
||||
{ text: '1' },
|
||||
{ text: '2' },
|
||||
@@ -60,8 +80,9 @@ const numbers = ref([
|
||||
|
||||
// Methods
|
||||
const ok = () => {
|
||||
const val = { val: nums.value }
|
||||
const val = { val: nums.value, symbol: symbol.value }
|
||||
nums.value = ''
|
||||
symbol.value = ''
|
||||
if (val.val) {
|
||||
uni.$emit('keyboardOK', val)
|
||||
}
|
||||
@@ -69,10 +90,12 @@ const ok = () => {
|
||||
|
||||
const setNull = () => {
|
||||
nums.value = ''
|
||||
symbol.value = ''
|
||||
uni.$emit('keyboardOK', null)
|
||||
}
|
||||
const clearNum = () => {
|
||||
nums.value = ''
|
||||
symbol.value = ''
|
||||
}
|
||||
const jianshao = () => {
|
||||
if (nums.value) {
|
||||
@@ -171,9 +194,15 @@ defineExpose({ clearNum })
|
||||
flex: 1;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.symbol {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.weight-data {
|
||||
flex: 5;
|
||||
color: #4cd964;
|
||||
text-align: right;
|
||||
letter-spacing: 5px;
|
||||
|
||||
Reference in New Issue
Block a user