出于某种原因,我的输入类型=“提交”不工作(它只在第一次工作)。我在自定义控件中写了输入。那会有问题吗?非常感谢您的帮助。谢谢。这是我的代码。
page.zoom = 4;
page.btn_Click = function() {
if (page.MobileNo) {
$http.get(serviceBasePath + '/api/Map/GetDeviceLocation?MobileNo=' + page.MobileNo).then(function(response) {
var deviceindex = page.DeviceData.findIndex(x => x.DeviceId== response.data.DeviceId);
if (deviceindex == -1) {
page.DeviceData.push(response.data);
page.zoom = 14;
page.center = response.data.Location.position;
} else {
page.zoom = 14;
page.center = response.data.Location.position;
}
}, function(error) {})
}
}
<custom-control style="padding-left:10px; padding-top:10px" position="TOP_LEFT" index="2" on-click="page.btn_Click()">
<input type="submit" class="form-control" value="GO">
</custom-control>
最佳答案
我认为您缺少表单标签。试试这个..
HTML::
<custom-control style="padding-left:10px; padding-top:10px" position="TOP_LEFT" index="2" on-click="page.btn_Click()">
<form name="formName" onsubmit="submitForm()">
<input type="text" name="firstName" placeholder="Enter Your Name">
<input type="submit" class="form-control" value="GO">
</form>
</custom-control>
脚本::
function submitForm(){
//... do something..
};
如果你想在 ENTER 键上进行一些操作,那么你必须有一些文本字段,否则点击它就可以了。
关于css - 输入类型 = "submit"在自定义控件中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48879788/