【发布时间】:2018-04-06 16:43:46
【问题描述】:
我正在尝试简单的函数,但函数没有返回任何内容,但是“控制台日志返回了正确的值,请问我的代码有什么问题?...
JS:
function potentieldated(Pimmatriculation, Pdateinstallation)
{
var db = dbGetHandle()
db.transaction(function (tx) {
var results = tx.executeSql(
'SELECT * FROM (SELECT * FROM (SELECT date_etape, heure_depart, heurecellule, cyclecellule from flight_log where immatriculation=? and date_etape <= ? ORDER by heure_depart desc) ORDER by date_etape desc limit 1)UNION ALL SELECT "0", "0", "0", "0" LIMIT 1 ' , [Pimmatriculation, Pdateinstallation])
var heurecellule= results.rows.item(0).heurecellule;
var cyclecellule= results.rows.item(0).cyclecellule;
console.log("heurecellule JS " + heurecellule);
console.log("cyclecellule JS "+ cyclecellule);
return {heurecellule:heurecellule,cyclecellule:cyclecellule}
})
}
QML 形式:
var potentiel= JS.potentieldated(stringVariable,dateaircraftpartinstallation)
var heure = potentiel.heurecellule
var cycle = potentiel.cyclecellule
console.log("heure "+heure)
console.log("cycle "+cycle)
console.log 消息:
qml: heurecellule JS 14010.25
qml: cyclecellule JS 4672
qrc: Cannot read property 'heurecellule' of undefined
你能帮帮我吗?
非常感谢
【问题讨论】:
标签: javascript qt qml multiple-value