当打开发布页面时,如第一张图,就自动弹出了地理位置地图,console.log()时,提示有过点击事件。在input组件中用focus="{{false}},关闭了键盘自动弹出,不然一个页面多个input,键盘就会闪,直到最后一个input组件闪现完成。
wxml代码:
<view class="container">
<form bindsubmit="onSubmitEvent">
<selecttwo></selecttwo>
<view class="weui-cell">
<view class="weui-cell__hd">工作性质</view>
<selectnature name="work" class="weui-cell__bd" prop-array='{{selectArray}}' />
</view>
<view class="weui-cell">
<view class="weui-cell__hd">学历要求</view>
<selectnature name="education" class="weui-cell__bd" prop-array='{{xueli}}' />
</view>
<view class="introduce-group">
<view class="introduce">职位描述</view>
<textarea name="content" class="textarea" placeholder="请输入您的招聘要求"></textarea>
</view>
<view class="location-group">
<view class="location-title">工作地址</view>
<view class="location-title-group" bindtap="onLocationTap">
<view class="location-name">{{location?location.address:"请填写您的工作地址"}}</view>
<image class="arrow" src="../../../images/arrow.png"></image>
</view>
</view>
<view class="input-group">
<import src="../../input/input.wxml" />
<view class="medata">
<block wx:for="{{cccs}}" wx:key="ccc">
<view data-index="{{index}}">
<template is="medata" data="{{...item}}"></template>
</view>
</block>
</view>
</view>
<button formType="submit">提交</button>
</form>
</view>
js代码:
/**
* 打开位置页面
*/
openLocationPage(){
const that=this;
wx.chooseLocation({
success:res=>{
if(res.address){
delete res["errMsg"];
that.setData({
location:res
})
}
}
})
},
/**
* 获取位置信息的事件
*/
onLocationTap:function(event){
const that = this;
wx.getSetting({
success:res=>{
const isLocation = res.authSetting['scope.userrLocation'];
if(isLocation){
that.openLocationPage();
}else{
wx.authorize({
scope:"scope.userLocation",
success:res=>{
that.openLocationPage();
}
})
}
}
})
},
input代码
<template name="medata">
<view class="me-list">
<text>{{id}}</text>
<input focus="{{false}}" name="name" placeholder="{{value}}"></input>
</view>
</template>
嗯,看看你的onLoad和onShow里怎么写的
const type=options.type;
this.setData({
type:type
})
this.onLocationTap();
},
onShow里面没有写代码,是不是被自动聚焦被自动打开了这个页面