我不理解以下内容。也许我在这里错过了一些非常愚蠢的问题...有人可以解决吗?预先感谢。
我在Javascript中有以下代码:
Calling Extraction
Service List Size: 1
Identified Ethernet Link:
Path: /net/connman/service/ethernet_0800277d326e_cable
Type: ethernet
Sate: ready
Favorite: 0
Auto Connect: 0
Name: Wired
Net Mode: manual
Iface: eth0
Mac: 08:00:27:7D:32:6E
IP Address: 10.0.2.15
Net Mask: 255.255.255.0
on_manager_properties_changed
children: 139764141513856
on_manager_properties_changed
children: 145
它就像一个护身符,因此,如果我更改document.getElementById ...并放上
signal time=1549641357.679460 sender=:1.3 -> destination=(null destination) serial=488 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "State"
variant string "ready"
signal time=1549641357.680844 sender=:1.3 -> destination=(null destination) serial=489 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "Nameservers"
variant array [
string "10.0.2.3"
]
signal time=1549641357.681186 sender=:1.3 -> destination=(null destination) serial=490 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "Domains"
variant array [
]
signal time=1549641357.681601 sender=:1.3 -> destination=(null destination) serial=491 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "Proxy"
variant array [
dict entry(
string "Method"
variant string "direct"
)
]
signal time=1549641357.681780 sender=:1.3 -> destination=(null destination) serial=492 path=/net/connman/technology/ethernet; interface=net.connman.Technology; member=PropertyChanged
string "Connected"
variant boolean true
signal time=1549641357.682210 sender=:1.3 -> destination=(null destination) serial=493 path=/; interface=net.connman.Manager; member=PropertyChanged
string "State"
variant string "ready"
signal time=1549641357.696004 sender=:1.3 -> destination=(null destination) serial=494 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "IPv4"
variant array [
dict entry(
string "Method"
variant string "dhcp"
)
]
signal time=1549641357.696227 sender=:1.3 -> destination=(null destination) serial=495 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "IPv4"
variant array [
dict entry(
string "Method"
variant string "dhcp"
)
dict entry(
string "Address"
variant string "10.0.2.15"
)
dict entry(
string "Netmask"
variant string "255.255.255.0"
)
]
signal time=1549641357.696454 sender=:1.3 -> destination=(null destination) serial=496 path=/net/connman/service/ethernet_0800277d326e_cable; interface=net.connman.Service; member=PropertyChanged
string "IPv4"
variant array [
dict entry(
string "Method"
variant string "dhcp"
)
dict entry(
string "Address"
variant string "10.0.2.15"
)
dict entry(
string "Netmask"
variant string "255.255.255.0"
)
dict entry(
string "Gateway"
variant string "10.0.2.2"
)
]
它也可以正常工作...但是,如果我放置“ return”,该函数将返回 undefined 变量内容。像这样:
function funcLeNrPaginasPDF(strCaminhoPDF) {
var objLivrariaPDF = window['pdfjs-dist/build/pdf'];
var objDocumentoPDF = null;
objLivrariaPDF.workerSrc = '/pdfjs/pdf.worker.js';
// strCaminhoPDF var contains the pdf doc: "documento.pdf"
var oprCarregaPDF = objLivrariaPDF.getDocument(strCaminhoPDF);
oprCarregaPDF.promise.then(function(objDocumentoPDF) { document.getElementById('nr_paginas').textContent = objDocumentoPDF.numPages; });
有什么想法吗?我需要一个变量来保存页面数。 问候。
答案 0 :(得分:0)
解决了。对于这种不重要且容易发现的故障感到愧。 返回必须放在内部函数的括号之外……ahmen。