求大佬指点~~~~~
H5页面点击输入框后,弹出软键盘会重载页面。
具体情况是:刚进网站的时候会第一次点击任意输入框弹出软键盘的瞬间会重载页面,但是第二次以后就没有这个问题了(只要不退出网站,刷新也不会再次出现这个问题了)。然后关闭网站重进,又会出现该问题。求大佬指点一下,卡了我两天了。。
项目是用XBuilder-X做的,代码如下:
<template>
<view>
<view class="container">
<view class="custom-nav">
<u-icon @click="goHome" style="margin-left: 10px;" v-if="userPermissions.includes('管理员')" name="home" color="#ffffff" size="22"></u-icon>
<text class="nav-title">策略</text>
</view>
</view>
<view class="checkbox-view">
<text class="label-text"> 选择策略:</text>
<u-checkbox-group
v-model="tacticsValue"
placement="row"
@change="tacticsCheckboxChange"
>
<u-checkbox
:customStyle="{marginBottom: '8px',marginRight:'10px'}"
v-for="(item, index) in tacticsCheckboxList"
:key="index"
:label="item.name"
:name="item.name"
>
</u-checkbox>
</u-checkbox-group>
</view>
<view class="checkbox-view">
<text class="label-text"> 级别:</text>
<u-checkbox-group
v-model="levelValue"
placement="row"
@change="levelCheckboxChange"
:wrap="false"
>
<u-checkbox
:customStyle="{
marginRight: '10px',
flexShrink: 0,
marginBottom: '0'
}"
v-for="(item, index) in levelCheckboxList"
:key="index"
:label="item.name"
:name="item.name"
>
</u-checkbox>
</u-checkbox-group>
</view>
<!-- 策略结果表格 -->
<view>
<view class="table-container">
<table class="fixed-table">
<thead class="sticky-header">
<tr>
<th class="sticky-col">代码</th>
<th @click="handleSort('level')">级别
<u-icon
v-if="sortConfig.field === 'level'"
:name="sortConfig.order === 'asc' ? 'arrow-up' : 'arrow-down'"
size="14"
color="#999"
/>
</th>
<th @click="handleSort('rsi')">
RSI
<u-icon
v-if="sortConfig.field === 'rsi'"
:name="sortConfig.order === 'asc' ? 'arrow-up' : 'arrow-down'"
size="14"
color="#999"
/>
</th>
<th @click="handleSort('ma')">
MA
<u-icon
v-if="sortConfig.field === 'ma'"
:name="sortConfig.order === 'asc' ? 'arrow-up' : 'arrow-down'"
size="14"
color="#999"
/>
</th>
</tr>
</thead>
<tbody>
<tr v-for="item in StrategyData" :key="item.id">
<td class="sticky-col" >
<view style="display: flex; width: 100%; justify-content: center;">
{{ item.symbol.padStart(6, '0') }}
<u-icon name="share-square" color="red" size="20" @click="openShow(item)"></u-icon>
</view>
</td>
<td>
{{ item.level }}
</td>
<td>
{{ item.rsi !== undefined ? formatDate(item.rsi, 'date') : ' - ' }}<br>
{{ item.rsi !== undefined ? formatDate(item.rsi, 'time') : ' - ' }}
</td>
<td>
{{ item.ma !== undefined ? formatDate(item.ma, 'date') : ' - ' }}<br>
{{ item.ma !== undefined ? formatDate(item.ma, 'time') : ' - ' }}
</td>
</tr>
</tbody>
</table>
</view>
</view>
<!-- menu -->
<u-tabbar
v-if="showItem()"
:value="menuValue"
activeColor="#e83030"
@change="name => menuValue = name"
:fixed="true"
:placeholder="false"
:safeAreaInsetBottom="false"
>
<u-tabbar-item text="策略" name="pages/tactics/tactics" icon="order" @click="clickMenu" ></u-tabbar-item>
<u-tabbar-item text="交易" name="pages/deal/deal" icon="checkmark-circle" @click="clickMenu" ></u-tabbar-item>
</u-tabbar>
<u-popup :show="popupShow" mode="right" closeable @close="popupClose" @open="popupOpen">
<view class="popup-content">
<!-- 表单开始 -->
<view class="form-item">
<text class="form-label">证券代码:</text>
<u-input v-model="form.symbol" placeholder="请输入6位证券代码" maxlength='6' @change="symbolInputChange">
<template slot="suffix">
<text class="text_style">{{ symbolSlotText }}</text>
</template>
</u-input>
</view>
<view class="form-item">
<text class="form-label">级别:</text>
<u-radio-group v-model="form.level" style="display: flex; flex-wrap: wrap;">
<u-radio
size="18px"
labelColor="#000000"
activeColor="#e83030"
v-for="item in levelOptions"
:key="item.value"
:name="item.value"
:label="item.label"
style="margin-right: 16px;"
></u-radio>
</u-radio-group>
</view>
<view class="form-item">
<text class="form-label">多空方向:</text>
<u-radio-group v-model="form.direction">
<u-radio name="做多" label="做多" size='18px' labelColor='#000000' activeColor="#e83030"></u-radio>
<u-radio name="做空" label="做空" size='18px' labelColor='#000000' activeColor="#e83030"></u-radio>
</u-radio-group>
</view>
<view class="form-item">
<text class="form-label">开仓算法:</text>
<u-radio-group v-model="form.algorithm" @change="handleAlgorithmChange">
<u-radio
size='18px' labelColor='#000000' activeColor="#e83030"
v-for="item in algorithmOptions"
:key="item.value"
:name="item.value"
:label="item.label"
></u-radio>
</u-radio-group>
</view>
<view class="form-item" v-if="form.algorithm === '0'">
<text class="form-label">基准价:</text>
<u-input v-model="form.basePrice" type="number" placeholder="请输入价格" >
</u-input>
</view>
<view class="form-item">
<text class="form-label">交易账户:</text>
<u-checkbox-group v-model="form.accounts" @change="accountsChange">
<u-checkbox
labelColor='#000000' activeColor="#e83030"
v-for="item in accountOptions"
:key="item.value"
:name="item.value"
:label="item.label"
style="margin-right: 16px;"
></u-checkbox>
</u-checkbox-group>
</view>
<view class="form-item">
<text class="form-label">交易模式:</text>
<u-radio-group v-model="form.tradeMode">
<u-radio name="手动下单" label="手动下单" labelColor='#000000' activeColor="#e83030"></u-radio>
<u-radio name="系统下单" label="系统下单" labelColor='#000000' activeColor="#e83030"></u-radio>
</u-radio-group>
</view>
<view class="form-item">
<text class="form-label">风控策略:</text>
<u-checkbox-group v-model="form.riskStrategies">
<u-checkbox
labelColor='#000000' activeColor="#e83030"
v-for="item in riskOptions"
:key="item.value"
:name="item.value"
:label="item.label"
style="margin-right: 16px;"
></u-checkbox>
</u-checkbox-group>
</view>
<view class="form-item">
<text class="form-label">份数:</text>
<u-input v-model="form.quantity" :max="balance" type="number" placeholder="请输入份数" onkeypress="if (event.keyCode == 13) return false;" @change="quanittyInputChange">
<template slot="suffix">
<text class="text_style">{{ balanceText }}</text>
</template>
</u-input>
</view>
<view class="form-buttons">
<u-button type="primary" @click="submitForm">确定</u-button>
<u-button @click="popupClose">取消</u-button>
</view>
</view>
</u-popup>
</view>
</template>