Blazor 组件 CSS 样式的共享与隔离
This commit is contained in:
parent
2759ee2e5d
commit
f9c3c85301
@ -7,9 +7,8 @@ spec:
|
|||||||
version: v1
|
version: v1
|
||||||
metadata:
|
metadata:
|
||||||
- name: redisHost
|
- name: redisHost
|
||||||
secretKeyRef:
|
value: "localhost:6379"
|
||||||
name: ConnectionStrings__cache
|
|
||||||
- name: redisPassword
|
- name: redisPassword
|
||||||
value: ""
|
value: "guest"
|
||||||
auth:
|
auth:
|
||||||
secretStore: env-secretstore
|
secretStore: env-secretstore
|
@ -13,7 +13,8 @@ var identitydb = postgres.AddDatabase("identitydb");
|
|||||||
var productdb = postgres.AddDatabase("productdb");
|
var productdb = postgres.AddDatabase("productdb");
|
||||||
var orderingdb = postgres.AddDatabase("orderingdb");
|
var orderingdb = postgres.AddDatabase("orderingdb");
|
||||||
|
|
||||||
var cache = builder.AddRedis("cache", port: 6380).WithLifetime(ContainerLifetime.Persistent).WithPersistence();
|
var redisPassword = builder.AddParameter("redisPassword", secret: true);
|
||||||
|
var cache = builder.AddRedis("cache", port: 6379, password: redisPassword).WithLifetime(ContainerLifetime.Persistent).WithPersistence();
|
||||||
|
|
||||||
var rabbitmqUser = builder.AddParameter("rabbitmqUser", secret: true);
|
var rabbitmqUser = builder.AddParameter("rabbitmqUser", secret: true);
|
||||||
var rabbitmqPassword = builder.AddParameter("rabbitmqPassword", secret: true);
|
var rabbitmqPassword = builder.AddParameter("rabbitmqPassword", secret: true);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"postgreUser": "postgres",
|
"postgreUser": "postgres",
|
||||||
"postgrePassword": "postgres",
|
"postgrePassword": "postgres",
|
||||||
"rabbitmqUser": "guest",
|
"rabbitmqUser": "guest",
|
||||||
"rabbitmqPassword": "guest"
|
"rabbitmqPassword": "guest",
|
||||||
|
"redisPassword": "guest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
src/HelloShop.AppShared/Components/Demo/CountComponent.razor
Normal file
19
src/HelloShop.AppShared/Components/Demo/CountComponent.razor
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<h1>@Title</h1>
|
||||||
|
|
||||||
|
<p role="status" class="counter-value">Current count: @InitCount</p>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public int InitCount { get; set; }
|
||||||
|
|
||||||
|
private void IncrementCount()
|
||||||
|
{
|
||||||
|
InitCount++;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
h1 {
|
||||||
|
color:dodgerblue;
|
||||||
|
}
|
@ -1,19 +1,7 @@
|
|||||||
@page "/counter"
|
@page "/counter"
|
||||||
@rendermode InteractiveAuto
|
@rendermode InteractiveAuto
|
||||||
|
@using HelloShop.AppShared.Components.Demo
|
||||||
|
|
||||||
<PageTitle>Counter</PageTitle>
|
<PageTitle>Counter</PageTitle>
|
||||||
|
|
||||||
<h1>Counter</h1>
|
<CountComponent InitCount="1" Title="Counter" />
|
||||||
|
|
||||||
<p role="status">Current count: @currentCount</p>
|
|
||||||
|
|
||||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private int currentCount = 0;
|
|
||||||
|
|
||||||
private void IncrementCount()
|
|
||||||
{
|
|
||||||
currentCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -57,4 +57,8 @@ h1:focus {
|
|||||||
|
|
||||||
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
|
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
|
||||||
text-align: start;
|
text-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.counter-value {
|
||||||
|
color:orangered;
|
||||||
}
|
}
|
@ -1,3 +1,3 @@
|
|||||||
@page "/component1"
|
@page "/component1"
|
||||||
|
|
||||||
<h3>Component1</h3>
|
<h1>Component1</h1>
|
@ -6,7 +6,7 @@
|
|||||||
<title>HelloShop.HybridApp</title>
|
<title>HelloShop.HybridApp</title>
|
||||||
<base href="/" />
|
<base href="/" />
|
||||||
<link rel="stylesheet" href="_content/HelloShop.AppShared/lib/bootstrap/dist/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="_content/HelloShop.AppShared/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" href="_content/HelloShop.AppShared/lib/app.css" />
|
<link rel="stylesheet" href="_content/HelloShop.AppShared/app.css" />
|
||||||
<link rel="stylesheet" href="HelloShop.HybridApp.styles.css" />
|
<link rel="stylesheet" href="HelloShop.HybridApp.styles.css" />
|
||||||
<link rel="icon" href="data:,">
|
<link rel="icon" href="data:,">
|
||||||
</head>
|
</head>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
@page "/component2"
|
@page "/component2"
|
||||||
@rendermode InteractiveAuto
|
@rendermode InteractiveAuto
|
||||||
|
@using HelloShop.AppShared.Components.Demo
|
||||||
|
|
||||||
<h3>Component2</h3>
|
<h3>Component2</h3>
|
||||||
|
|
||||||
|
<CountComponent InitCount="30" Title="Counter1" />
|
||||||
|
@ -1,4 +1,15 @@
|
|||||||
@page "/component1"
|
@page "/component1"
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
|
|
||||||
<h3>Component1</h3>
|
@using HelloShop.AppShared.Components.Demo
|
||||||
|
|
||||||
|
<h1>Component1</h1>
|
||||||
|
|
||||||
|
<div class="border my-3 p-3">
|
||||||
|
<CountComponent Title="Counter1" InitCount="1"></CountComponent>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border my-3 p-3">
|
||||||
|
<CountComponent Title="Counter2" InitCount="2"></CountComponent>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
::deep .counter-value {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
"applicationUrl": "http://localhost:5224",
|
"applicationUrl": "http://localhost:8080",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
"applicationUrl": "https://localhost:7169;http://localhost:5224",
|
"applicationUrl": "https://localhost:8181;http://localhost:8080",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user