在需要顶级等待之后,我现在花了一个小时寻找新错误的解决方案。到目前为止我尝试过的所有其他方法都没有解决错误,例如添加"type": "module"到 package.json 文件中。
错误消息是Cannot use import statement outside a module在启动服务时。如果我将更改恢复"module": "ESNext",为"module": "commonjs",,它工作正常(除了必须删除 await 关键字并以某种方式重构以在没有等待的情况下工作)。
另外,我使用 ts-node-dev 来运行服务,可以在 package.json 文件中看到。
包.json
{
"name": "",
"version": "1.0.0",
"description": "microservice",
"main": "src/index.ts",
"author": "",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "NODE_ENV=development tsnd --respawn --files src/index.ts",
"prod": "NODE_ENV=production tsnd --respawn --transpile-only --files src/index.ts",
"test": "mocha --exit -r ts-node/register tests/**/*.spec.ts",
"eslint": "eslint src/**/*.ts"
},
Run Code Online (Sandbox Code Playgroud)
配置文件
{
"compilerOptions": {
"target": "ES2020",
"module": …Run Code Online (Sandbox Code Playgroud) 我有三个名为 core、common 和 item 的模块,每个模块都是 Maven 项目的子模块。我正在使用 ServiceLoader 来实现服务方法,并使用 Java 11 和 fontawesomefx 11(最新)。
我没有使用过 Java 的模块系统,所以我不知道我对模块信息文件的处理是否正确。然而,核心和项目模块都需要 fontawesomefx 模块,并且会导致以下错误:
Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package license in both module de.jensd.fx.fontawesomefx.materialicons and module de.jensd.fx.fontawesomefx.materialdesignicons
Run Code Online (Sandbox Code Playgroud)
所有子模块的模块信息:
module common {
requires javafx.graphics;
requires javafx.controls;
requires de.jensd.fx.fontawesomefx.commons;
exports common.abstractions;
exports common.services;
exports common.sidebar;
opens common.services;
}
module core {
requires common;
requires javafx.controls;
requires javafx.fxml;
requires de.jensd.fx.fontawesomefx.materialdesignicons;
uses common.services.ISidebarPlugin;
exports core.ui to javafx.graphics;
exports core.ui.mainpage to javafx.fxml;
exports core.ui.sidebar to javafx.fxml; …Run Code Online (Sandbox Code Playgroud) 我在顶部有一个导航栏,在<router-view>其右下方有一个导航栏(如 中所示App.vue)。我希望导航栏中的标题根据我所在的路线/视图而改变。由于我的视图<router-view>不包含标题本身,因此我需要在某处定义它们。该场景的一个示例是,当到达路线时/login,导航栏中的标题更改为“登录”。我该如何实现这一目标?
在寻找解决方案时,我遇到了很多页面标题问题。我不是在谈论document.title作业,但是,这可能是一种解决方案,但不是一个完美的解决方案。如果我希望标题不是文档标题,该怎么办?
应用程序.vue:
<template>
<Menu :isActive="isMenuActive" />
<Navbar @toggle:hamburger="onHamburgerToggle($event)" />
<router-view />
</template>
Run Code Online (Sandbox Code Playgroud) async-await ×1
css ×1
font-awesome ×1
html ×1
java-11 ×1
java-module ×1
javafx-11 ×1
node.js ×1
typescript ×1
vue-router ×1
vuejs3 ×1