The following members of QML type Qt 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。
(obsolete)
|
對象 包括 ( string url , jsobject callback ) |
This method is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
This method should not be used. Use ECMAScript modules instead and the native JavaScript
import
and
export
statements instead.
Includes another JavaScript file. This method can only be used from within JavaScript files, and not regular QML files.
This imports all functions from url into the current script's namespace.
Qt.include() returns an object that describes the status of the operation. The object has a single property,
status
, that is set to one of the following values:
| Symbol | 值 | 描述 |
|---|---|---|
| result.OK | 0 | The include completed successfully. |
| result.LOADING | 1 | Data is being loaded from the network. |
| result.NETWORK_ERROR | 2 | A network error occurred while fetching the url. |
| result.EXCEPTION | 3 |
A JavaScript exception occurred while executing the included code. An additional
exception
property will be set in this case.
|
The
status
property will be updated as the operation progresses.
If provided, callback is invoked when the operation completes. The callback is passed the same object as is returned from the Qt.include() call.