// 获取Iphone底部安全距离
.bottom {
bottom: env(safe-area-inset-bottom);
}
// width: 胶囊宽度 height:胶囊高度 top: 胶囊上边框到顶部距离 bottom: 胶囊下边框距离顶部距离
// left: 胶囊左边距离手机屏幕左侧距离 right: 胶囊右边距离手机屏幕左侧距离
// 获取胶囊相关数据的二次处理
const useMenuButtonObject = () => {
const [capsuleObject, setCapsuleObject] = useState({height: 0, top: 0, right: 0});
useEffect(() => {
const _capsuleObject = wx.getMenuButtonBoundingClientRect(); // 获取胶囊对象
setCapsuleObject(_capsuleObject);
}, []);
return capsuleObject
}
// 手机软键盘显示搜索并点击调用搜索
const onSearch = () => {
// 执行搜索相关方法
props.onSearch && props.onSearch();
};
<Input placeholderStyle="color:#bfbfbf;" placeholderClass={style.placeholder} confirmType="search" {...props.InputProps} onConfirm={onSearch} onInput={onChange} />
confirmType?: 'send' | 'search' | 'next' | 'go' | 'done'
/** 点击完成按钮时触发
*
* event.detail = {value: value}
* @supported weapp, rn, tt
* @h5 借用[Form 组件](./form)的`onSubmit`事件来替代
*/
onConfirm?: CommonEventFunction<InputProps.inputValueEventDetail>
// 小程序无法显示页面,实际上代码没问题
解决办法:
找到C:\Users\当前系统用户名\AppData\Local\下的微信开发者工具,直接删除然后重启微信开发者工具即可