feat:符号选择

This commit is contained in:
houjunxiang
2025-12-22 15:36:59 +08:00
parent 4d1e709be9
commit 164e305442
2 changed files with 78 additions and 15 deletions

View File

@@ -1,6 +1,15 @@
<template> <template>
<view class="y-f" style="height: 55vh"> <view class="y-f" style="height: 55vh">
<view class="weight"> <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 class="weight-data">{{ nums }}</view>
</view> </view>
@@ -35,6 +44,10 @@ const props = defineProps({
numKeyboardParam: { numKeyboardParam: {
type: Object, type: Object,
default: () => null default: () => null
},
showSymbol: {
type: Boolean,
default: false
} }
}) })
@@ -43,6 +56,13 @@ const props = defineProps({
// Data // Data
const nums = ref('') const nums = ref('')
const symbol = ref('')
const range = ref([
{ value: '=', text: '=' },
{ value: '<', text: '<' }
])
const numbers = ref([ const numbers = ref([
{ text: '1' }, { text: '1' },
{ text: '2' }, { text: '2' },
@@ -60,8 +80,9 @@ const numbers = ref([
// Methods // Methods
const ok = () => { const ok = () => {
const val = { val: nums.value } const val = { val: nums.value, symbol: symbol.value }
nums.value = '' nums.value = ''
symbol.value = ''
if (val.val) { if (val.val) {
uni.$emit('keyboardOK', val) uni.$emit('keyboardOK', val)
} }
@@ -69,10 +90,12 @@ const ok = () => {
const setNull = () => { const setNull = () => {
nums.value = '' nums.value = ''
symbol.value = ''
uni.$emit('keyboardOK', null) uni.$emit('keyboardOK', null)
} }
const clearNum = () => { const clearNum = () => {
nums.value = '' nums.value = ''
symbol.value = ''
} }
const jianshao = () => { const jianshao = () => {
if (nums.value) { if (nums.value) {
@@ -171,9 +194,15 @@ defineExpose({ clearNum })
flex: 1; flex: 1;
padding: 8px; padding: 8px;
box-sizing: border-box; box-sizing: border-box;
display: flex;
align-items: center;
.symbol {
flex: 1;
}
} }
.weight-data { .weight-data {
flex: 5;
color: #4cd964; color: #4cd964;
text-align: right; text-align: right;
letter-spacing: 5px; letter-spacing: 5px;

File diff suppressed because it is too large Load Diff