fix: 替换 u-input 为原生 input,修复微信小程序兼容性问题

This commit is contained in:
claw_bot 2026-03-18 08:56:35 +00:00
parent 32e8e8b5eb
commit 16f3a492e1
3 changed files with 54 additions and 24 deletions

View File

@ -32,11 +32,10 @@
<view class="form-item">
<text class="label">组合名称</text>
<u-input
<input
v-model="form.name"
placeholder="给你的组合起个名字 (如: 养老定投)"
:border="false"
:customStyle="{ backgroundColor: '#F9FAFB', borderRadius: '20rpx', height: '96rpx', padding: '0 32rpx' }"
class="native-input"
/>
</view>
@ -87,13 +86,12 @@
<view class="item-grid">
<view class="grid-col relative">
<text class="sub-label">单元名称/代码</text>
<u-input
<input
v-model="item.name"
placeholder="如 TMF"
:disabled="selectedStrategy?.type === 'risk_parity'"
:border="false"
:customStyle="{ backgroundColor: '#FFFFFF', borderRadius: '16rpx', height: '72rpx', padding: '0 20rpx' }"
@input="(e) => searchStock(e, index)"
class="native-input-sm"
@input="(e) => searchStock(e.detail.value, index)"
@focus="() => { activeSearchIndex.value = -1; searchResults.value = []; }"
/>
<!-- 搜索下拉列表 -->
@ -114,22 +112,20 @@
</view>
<view class="grid-col">
<text class="sub-label">买入均价</text>
<u-input
<input
v-model="item.price"
type="number"
placeholder="0.00"
:border="false"
:customStyle="{ backgroundColor: '#FFFFFF', borderRadius: '16rpx', height: '72rpx', padding: '0 20rpx' }"
class="native-input-sm"
/>
</view>
<view class="grid-col">
<text class="sub-label">持有数量</text>
<u-input
<input
v-model="item.amount"
type="number"
placeholder="0"
:border="false"
:customStyle="{ backgroundColor: '#FFFFFF', borderRadius: '16rpx', height: '72rpx', padding: '0 20rpx' }"
class="native-input-sm"
/>
</view>
</view>
@ -757,4 +753,24 @@ onShow(async () => {
.btn-submit {
/* 样式已内联设置 */
}
/* 原生 input 样式 */
.native-input {
background-color: #F9FAFB;
border-radius: 20rpx;
height: 96rpx;
padding: 0 32rpx;
font-size: 28rpx;
color: #1F2937;
}
.native-input-sm {
background-color: #FFFFFF;
border-radius: 16rpx;
height: 72rpx;
padding: 0 20rpx;
font-size: 26rpx;
color: #1F2937;
border: 1rpx solid #E5E7EB;
}
</style>

View File

@ -423,11 +423,10 @@
<view class="form-item">
<text class="form-label">备注</text>
<u-input
<input
v-model="transactionForm.remark"
placeholder="请输入备注(可选)"
:border="false"
:customStyle="{ backgroundColor: '#F9FAFB', borderRadius: '16rpx', height: '80rpx', padding: '0 20rpx', border: '2rpx solid #E5E7EB' }"
class="native-input-remark"
/>
</view>
</view>
@ -1719,4 +1718,15 @@ const deletePortfolio = async () => {
.nav-stats .text-green {
color: #DC2626;
}
/* 原生 input 样式 */
.native-input-remark {
background-color: #F9FAFB;
border-radius: 16rpx;
height: 80rpx;
padding: 0 20rpx;
border: 2rpx solid #E5E7EB;
font-size: 28rpx;
color: #1F2937;
}
</style>

20
todo.md
View File

@ -38,21 +38,25 @@
## 待处理
### P1 - CSS 清理
- [ ] index.vue: 检查并移除未使用的 CSS 类
- [ ] detail.vue: 进一步清理冗余样式
- [ ] config.vue: 优化表单样式
### P1 - CSS 清理 ✅ 完成
- [x] index.vue: 检查并移除未使用的 CSS 类
- [x] detail.vue: 进一步清理冗余样式
- [x] config.vue: 优化表单样式
### P2 - 代码质量
- [ ] 统一错误处理机制
- [ ] 添加 TypeScript 类型定义
- [ ] 优化 API 调用封装
### P2 - 小程序兼容性 ✅ 完成
- [x] config.vue: 替换 4 处 u-input 为原生 input
- [x] detail.vue: 替换 1 处 u-input 为原生 input
### P3 - 功能增强
- [ ] 下拉刷新
- [ ] 上拉加载更多
- [ ] 空状态优化
### P4 - 代码质量
- [ ] 统一错误处理机制
- [ ] 添加 TypeScript 类型定义
- [ ] 优化 API 调用封装
## 兼容性
- ✅ 微信小程序(已验证)
- ⚠️ H5需要条件编译恢复