我有一个链接列表,当悬停它们时,我希望字体平滑增长.
目前,即使使用,字体也会立即增长transition.
#menuHeader {
font-weight: bold;
}
.link {
text-decoration: none;
}
.menuItem {
list-style-type: none;
margin-bottom: 10px;
}
.menuLink {
transition-property: font-size;
transition-property: color;
transition-duration: 0.3s;
font-size: 16px;
color: #000000;
}
.menuLink:hover {
transition-property: font-size;
transition-property: color;
transition-duration: 0.3s;
font-size: 20px;
color: #97d700;
}Run Code Online (Sandbox Code Playgroud)
<ul>
<li class="menuItem" id="menuHeader">Title</li>
<li class="menuItem"><a class="link menuLink" href="/">Link 1</a></li>
<li class="menuItem"><a class="link menuLink" href="/">Link 2</a></li>
<li class="menuItem"><a class="link menuLink" href="/">Link 3</a></li>
</ul>Run Code Online (Sandbox Code Playgroud)
这是一个示范页面
https://www.roidna.com/services/
当悬停在它们上方时,块中附着的链接会变大.
我使用 Vue.js 和 Vuetify 使用 Vue CLI 创建了一个项目。我想用 Github Pages 托管这个应用程序。所以我从这里拿了一个指南
而且我没有使用 Vue Router ( https://router.vuejs.org/guide/essentials/history-mode.html )的历史记录来确保我不需要服务器。
我创建了我的项目的构建并将生成的 dist 文件夹重命名为 docs。此 docs 文件夹位于根目录(生成它的位置)中。当我选择master 分支 /docs 文件夹作为我的 Github Pages 发布源时,我得到一个空白页面。
当我检查控制台时,我得到一个
加载资源失败:服务器响应状态为 404()
对于在 dist/docs 文件夹中生成的每个文件。我错过了什么?
我有一个从复杂对象构造字符串的简单函数。为了简单起见,我会这样做
public generateMessage(property: string): string {
return `${property} more text.`;
}
Run Code Online (Sandbox Code Playgroud)
我的测试目前是
it('starts the message with the property name', () => {
const property = 'field';
const message: string = myClass.generateMessage(property);
expect(message).toEqual(`${property} more text.`);
});
Run Code Online (Sandbox Code Playgroud)
这里唯一相关的是生成的消息以属性开头。有没有办法可以检查字符串是否以该属性开头?伪代码:
expect(message).toStartWith(property);
还是我必须使用startsWith()字符串方法自己完成?目前我想到的最佳解决方案是
expect(message.startsWith(property)).toBeTruthy();
Run Code Online (Sandbox Code Playgroud) 我有一个循环并想要循环条,其值范围从0到1并返回0.
所以,目前我使用这个代码
public class DayNightCycle : MonoBehaviour
{
private float currentTime = 0; // current time of the day
private float secondsPerDay = 120; // maximum time per day
private Image cycleBar; // ui bar
private void Start()
{
cycleBar = GetComponent<Image>(); // reference
UpdateCycleBar(); // update the ui
}
private void Update()
{
currentTime += Time.deltaTime; // increase the time
if (currentTime >= secondsPerDay) // day is over?
currentTime = 0; // reset time
UpdateCycleBar(); // update ui
} …Run Code Online (Sandbox Code Playgroud) 我想在 Unity 中创建一个带有精灵的网格。每个单元格上都应该有一个数字。
它应该是这样的
我的网格看起来是这样的
所以我生成单元格并将它们添加到一个名为的空游戏对象中
地图
private GameObject cellPrefab;
private const int CELL_COUNT_X = 10; // create 100 cells
private const int CELL_COUNT_Y = 10;
private const float CELL_SPACING = 1.1f; // with a small spacing
private List<Cell> cells = new List<Cell>(); // store all cells here
private const int NUM_RANGE_MIN = 1; // cell value range
private const int NUM_RANGE_MAX = 10;
private void Start()
{
cellPrefab = Resources.Load(StringCollection.CELL) as GameObject;
for (int x = 0; x < …Run Code Online (Sandbox Code Playgroud) 我想将我的关卡文件保存到 Unity 资产文件夹中的 .json 文件中。由于JsonUtility我想使用Json.NET 的功能有限。我使用 Linux,所以我无法访问 Visual Studio,而是使用 Visual Studio Code。我想将包添加到我的 Unity 项目中,并从这里获取指南
在 Visual Studio Code 中安装 Nuget 包
首先我在终端中使用了这个命令
dotnet add package Newtonsoft.Json
Run Code Online (Sandbox Code Playgroud)
但我收到了这个错误
错误:将包“Newtonsoft.Json”添加到项目“/.../myUnityProject/Assembly-CSharp.csproj”时出错。项目不支持通过 add package 命令添加包引用。
之后,我安装了 Nuget 扩展并将 Newtonsoft.Json@12.0.2 安装到我的项目中。系统提示我运行dotnet restore才能使用该软件包。
这样做后我得到了这个错误
MSBUILD:错误 MSB1011:指定要使用的项目或解决方案文件,因为此文件夹包含多个项目或解决方案文件。
那么使用带有 Unity 的 Visual Studio Code 安装第三方工具的正确方法是什么?
我想使用 NestJs 和 TypeORM 创建一个 REST API。在我的app.module.ts中,我加载 TypeORM 模块
@Module({
imports: [
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'postgres',
database: 'api',
entities: [`${__dirname}/**/*.entity.{ts,js}`],
synchronize: true,
}),
],
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
目前运行良好。我想从外部 .env 文件加载配置,以便从文档中加载
https://docs.nestjs.com/techniques/database#async-configuration
从这里开始
NestJS 将 ConfigService 与 TypeOrmModule 结合使用
我在根项目目录中创建了一个 .env 文件,内容如下
DATABASE_TYPE = postgres
DATABASE_HOST = localhost
DATABASE_PORT = 5432
DATABASE_USERNAME = postgres
DATABASE_PASSWORD = postgres
DATABASE_NAME = api
DATABASE_SYNCHRONIZE = true
Run Code Online (Sandbox Code Playgroud)
接下来我将代码更新为
@Module({
imports: [
ConfigModule.forRoot(),
TypeOrmModule.forRootAsync({
imports: …Run Code Online (Sandbox Code Playgroud) 我有一个 .Net 5 应用程序,想要使用 dotnet 格式。首先,我将commitlint、husky和lint-staged添加到存储库中。文件夹结构如下
\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package.json\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 MyCsharpProject\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 MyCsharpProject.sln\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Assembly1\nRun Code Online (Sandbox Code Playgroud)\n配置的 package.json 文件如下所示
\n{\n "lint-staged": {\n "*.cs": "dotnet format --include"\n },\n "devDependencies": {\n "@commitlint/cli": "^12.1.1",\n "@commitlint/config-conventional": "^12.1.1",\n "husky": "^6.0.0",\n "lint-staged": "^10.5.4"\n },\n "scripts": {\n "prepare": "husky install"\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n挂钩失败并显示此输出
\n> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -\n[STARTED] Preparing...\n[SUCCESS] Preparing...\n[STARTED] Running tasks...\n[STARTED] Running tasks for *.cs\n[STARTED] dotnet format --include\n[FAILED] dotnet format --include [FAILED]\n[FAILED] dotnet format --include [FAILED]\n[SUCCESS] Running …Run Code Online (Sandbox Code Playgroud) 我有一个 .Net 5 Web Api 项目并想使用
地图大师 v7.2.0
以避免手动映射对象。以下代码显示了示例场景
。
[ApiController]
[Route("[controller]")]
public class MyController : ControllerBase
{
[HttpGet]
public ActionResult<UsernameWithTodoTitle> Get()
{
TypeAdapterConfig<(User, Todo), UsernameWithTodoTitle>
.NewConfig()
.Map(dest => dest, src => src.Item1) // map everything from user
.Map(dest => dest, src => src.Item2) // map everything from todo
.Map(dest => dest.TodoTitle, src => src.Item2.Title); // map the special fields from todo
var user = new User { Username = "foo", FieldFromUser = "x" };
var todo …Run Code Online (Sandbox Code Playgroud) 我想从我的 NodeJs 应用程序发送电子邮件。
const nodemailer = require('nodemailer');
const senderMail = "myemail@yahoo.com";
const emailTransporter = nodemailer.createTransport({
service: 'yahoo',
auth: {
user: senderMail,
pass: 'mypassword'
}
});
function getMailReceivers(mailReceivers) { // convert the string array to one string
var receivers = "";
for (var i = 0; i < mailReceivers.length; i++) {
receivers += mailReceivers[i];
if (i < mailReceivers.length - 1)
receivers += ", ";
}
return receivers;
}
function getMailOptions(mailReceivers, subj, content) { // set the options and return them
return …Run Code Online (Sandbox Code Playgroud) c# ×5
.net ×1
.net-5 ×1
.net-core ×1
css ×1
github-pages ×1
html ×1
husky ×1
javascript ×1
jestjs ×1
lint-staged ×1
mapster ×1
nestjs ×1
node.js ×1
nodemailer ×1
nuget ×1
typeorm ×1
typescript ×1
vue-cli ×1
vue-cli-3 ×1
vue.js ×1
vuetify.js ×1