Knockout js Button适用于IE 11但不适用于Chrome

时间:2017-03-17 10:15:34

标签: javascript jquery html knockout.js

我有3个按钮,后面有一些显示逻辑。在IE 11中是否完美无缺,但在Chrome中无效。我目前不知道问题是什么。

这是3个按钮之一

<div data-bind="click: conConfirmTransmit, visible: currentProcessStatusProgramCode() === 'CONSULTING', enable: isAllowedToConfirmAndTransmit" class="confirm-button">

前进

根据我将isAllowedToConfirmAndTransmit设置为true / false

的逻辑

知道代码有什么问题吗?这个按钮在我的情况下总是可见

1 个答案:

答案 0 :(得分:0)

似乎对我有用,而且我正在运行chrome但是我不认为启用绑定会对div有效。你为什么不用按钮?

value=[{u'originDisplay': [], u'destinationDisplay': [], 
  u'stopPointRef': {u'value': u'STIF:StopPoint:Q:24684:'}, 
  u'expectedDepartureTime': u'2017-03-17T19:00:00.000Z', 
  u'stopPointName': [], u'arrivalOperatorRefs': []}, 
 {u'originDisplay': [], u'destinationDisplay': [], 
  u'stopPointRef': {u'value': u'STIF:StopPoint:Q:24683:'}, 
  u'expectedDepartureTime': u'2017-03-17T19:00:00.000Z', 
  u'stopPointName': [], u'arrivalOperatorRefs': []}, 
 {u'originDisplay': [], u'destinationDisplay': [],
  u'stopPointRef': {u'value': u'STIF:StopPoint:Q:24680:'}, 
  u'expectedDepartureTime': u'2017-03-17T19:00:00.000Z', 
  u'stopPointName': [], u'arrivalOperatorRefs': []}, 
 {u'originDisplay': [], u'destinationDisplay': [], 
  u'stopPointRef': {u'value': u'STIF:StopPoint:Q:24687:'}, 
  u'expectedDepartureTime': u'2017-03-17T19:00:00.000Z', 
  u'stopPointName': [], u'arrivalOperatorRefs': []}, 
 {u'originDisplay': [], u'destinationDisplay': [], 
  u'stopPointRef': {u'value': u'STIF:StopPoint:Q:24686:'}, 
  u'expectedDepartureTime': u'2017-03-17T19:00:00.000Z', 
  u'stopPointName': [], u'arrivalOperatorRefs': []}, 
 {u'originDisplay': [], u'destinationDisplay': [], 
  u'stopPointRef': {u'value': u'STIF:StopPoint:Q:24685:'}, 
  u'expectedDepartureTime': u'2017-03-17T19:00:00.000Z',
  u'stopPointName': [], u'arrivalOperatorRefs': []}]
#I am attempting to build the vehicle dict like the one you have
vehicle={}
vehicle["estimatedCalls"]={"estimatedCall":value}

for call in vehicle['estimatedCalls']['estimatedCall']:
    print("\n\n")
    #stoptime = ent.trip_update.stop_time_update.add()
    expected_arrival_time= call['expectedArrivalTime'] if 'expectedArrivalTime' in call else None
    expected_departure_time=call["expectedDepartureTime"]
    aimed_departuretime=call['aimedDepartureTime'] if 'aimedDepartureTime' in call else None
    aimed_arrivaltime=call['aimedArrivalTime'] if 'aimedArrivalTime' in call else None
    print("stop id is",call['stopPointRef']['value'])
    print("expected Arrival time is",expected_arrival_time)
    print("expected departure time is",expected_departure_time)
    print("aimed departure time is",aimed_departuretime)
    print("aimed arrival time time is",aimed_arrivaltime)
function vm() {
 this.currentProcessStatusProgramCode = ko.observable('CONSULTING');
 this.isAllowedToConfirmAndTransmit = ko.observable(true);
 this.conConfirmTransmit = function(){
  alert('conConfirmTransmit');
 }
 
}

var mymodel = new vm();

$(document).ready(function() {
  ko.applyBindings(mymodel);
});
.confirmbutton{
	display:block;
	border-style:solid;
	border-color:#bbb #888 #666 #aaa;
	border-width:3px 4px 4px 3px;
	width:9em;
	height:2em;
	background:#ccc;
	color:#333;
	line-height:2;
	text-align:center;
	text-decoration:none;
	font-weight:900;
}
.confirmbutton:hover{
	border-color: #666 #aaa #bbb #888;
	border-width:4px 3px 3px 4px;
	color:#000;
}