我正在尝试将我的组件从 MUI v4 迁移到 v5,但我已经不知道如何迁移我的makeStyles
组件了。
之前,我有过类似的工作:
const useStyles = makeStyles((theme: Theme) => ({
paper: {
padding: theme.spacing(2),
someMore: 'styles'
}
}));
// ...
const Component: FC = () => {
const theme = useTheme();
const classes = useStyles(theme);
return (
<Paper elevation={3} className={classes.paper}>
<Stuff />
</Paper>
)
}
Run Code Online (Sandbox Code Playgroud)
现在我在通话时遇到错误useStyles
:
该表达式不可调用。类型“never”没有调用签名.ts(2349)
这种情况下的解决方法是什么?
如果要使用 Az.Accounts 连接到特定订阅,请执行以下操作:
Connect-AzAccount -SubscriptionId <guid> etc...
Run Code Online (Sandbox Code Playgroud)
我发现无法使用 指定 SubscriptionId az login
。
例如,如果我的帐户管理多个订阅,那么列出所有资源组时会发生什么情况?
如何只登录一项订阅?
在 VS2019 预览版中,您有多个模板。我对以下两个感兴趣:
我对两者都进行了一些尝试,发现了一些差异。在ASP.NET Core with React.js
模板中,启动了 SPA 代理服务器,而在 中则ASP.NET Core with React.js and Redux
无需启动 SPA 代理服务器(第二个模板在 TS 中,而不是 JS)。
我的意思是simply works without that
。我查看了这两个.csproj
文件,发现了差异(我只会附加值得注意的差异):
第一个模板:
...
<SpaProxyServerUrl>https://localhost:5002</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="6.0.0-preview.6.21355.2" />
</ItemGroup>
...
<ItemGroup>
<DistFiles Include="$(SpaRoot)build\**" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>wwwroot\%(RecursiveDir)%(FileName)%(Extension)</RelativePath>
...
Run Code Online (Sandbox Code Playgroud)
第二个模板:
...
# SpaProxy stuff missing
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.0-preview.5.21301.17" />
</ItemGroup>
...
<ItemGroup>
<DistFiles Include="$(SpaRoot)build\**; $(SpaRoot)build-ssr\**" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
Run Code Online (Sandbox Code Playgroud)
请注意,在第二个模板中Microsoft.AspNetCore.SpaServices.Extensions
使用的是而不是Microsoft.AspNetCore.SpaProxy …
我正在尝试将我的 Jenkins 服务器与 github 项目链接起来。当使用 GitHub 作为源设置多分支管道作业并添加我的凭据时,出现以下错误:
Invalid credentials: https://api.github.com/user {"message":"Requires authentication","documentation_url":"https://docs.github.com/rest/reference/users#get-the-authenticated-user"}
Run Code Online (Sandbox Code Playgroud)
我检查了我的凭据,它们实际上是正确的。可能是什么问题呢?
在配置中,我添加了https://api.github.com
作为 GitHub 服务器。在那里我检查了我的 GPAT 证书,它们有效。
渲染 aBox
会产生以下错误:
表达式生成的联合类型太复杂而无法表示。ts(2590)
正如我在这里看到的,这是因为同时安装了@mui/material
和@react-three/drei
& @react-three/fiber
。
这个错误背后的原因是什么?我只Box
从 导入组件mui
。是否存在类型混淆或其他问题?解决方案/解决方法是什么?
重现步骤:
npx create-react-app my-app --template typescript
package.json
"dependencies": {
"@azure/msal-browser": "^2.18.0",
"@azure/msal-react": "^1.1.0",
"@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0",
"@mui/icons-material": "^5.0.4",
"@mui/lab": "^5.0.0-alpha.51",
"@mui/material": "^5.0.4",
"@mui/system": "^5.0.4",
"@react-three/drei": "^7.16.8",
"@react-three/fiber": "^7.0.17",
"axios": "^0.23.0",
"dotenv": "^10.0.0",
"localforage": "^1.10.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
"three": "^0.133.1",
"three-stdlib": "^2.5.4",
"web-vitals": "^1.1.2",
"zustand": "^3.5.14"
},
"devDependencies": {
"@testing-library/jest-dom": …
Run Code Online (Sandbox Code Playgroud) 我正在尝试设置一个网络应用程序,该应用程序通过文件共享到存储帐户来进行持久存储。
我遵循 Microsoft 文档中的各种指南,并且成功完成了大部分工作,我的应用程序具有持久存储。但现在,我想做的,是将卷映射到我的存储帐户。
我看到${WEBAPP_STORAGE_HOME}
我可以在 docker-compose 中使用这个变量。
我的问题是,这个变量的值是多少?文档指出:
${WEBAPP_STORAGE_HOME}
是应用服务中的一个环境变量,映射到应用的持久存储。
我觉得这有点模糊。它是否知道自动映射我的路径映射?如果我有多个路径映射怎么办?我应该在刀片的应用程序设置中设置该值吗Configuration
?如果是这样,我需要指定什么,安装路径?
除此之外,我看到它的用法如下:
version: '3.3'
services:
wordpress:
image: mcr.microsoft.com/azuredocs/multicontainerwordpress
volumes:
- ${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html
ports:
- "8000:80"
restart: always
Run Code Online (Sandbox Code Playgroud)
我在 docker-compose 中使用命名卷。我认为没有必要指定类似的东西?
更新 @Jason Pan 的回答后,我尝试稍微玩一下这个坐骑。
我使用以下 docker-compose 成功在应用服务上实现了持久存储:
# ... lines skipped for brevity
volumes:
- mysql-data:/var/lib/mysql
volumes:
mysql-data:
driver: local
Run Code Online (Sandbox Code Playgroud)
但我想将数据保留在存储帐户上。我发现这可以通过:AppService/Configuration/Path Mappings
。
我的 Docker 撰写
# ...
volumes:
- MyMountedPath:/var/lib/mysql
Run Code Online (Sandbox Code Playgroud)
mysql:8
准确地说,在这个 docker-compose 文件中,我有我的应用程序和 MySQL 映像。
我安装的路径如下:
Name: MyMountedPath; Mounted Path: /usr/local/mysql; Type: Azure …
我有以下包含 3 列的 DataFrame a, b, c
。我将 DF 按 c 分组
dfByC = groupby(df, [:C])
Run Code Online (Sandbox Code Playgroud)
如何从dfByC
的某个值中选择一个组c
?
我正在学习桥梁设计模式。去引用:
\n\n\n桥接模式试图通过从继承切换到对象来解决这个问题
\ncomposition
。\xe2\x80\xa6
然后,显示下图:
\n\n当人们谈论组合作为继承的替代方案时,他们是否指的是聚合关系和组合关系?如果不是,它们到底是什么意思?
\n我想知道这一点,因为图片 和 之间是聚合关系,而不是合成关系。Color
Shape
我想访问effectiveType
NetworkInformation对象downlink
的属性。
我知道这些属性可能不存在,具体取决于浏览器,我正在检查如下:
const info: string[] = ['Downloading...'];
if ('connection' in window.navigator) {
info.push(`Connection Type: ${navigator.connection.effectiveType}`);
if ('downlink' in window.navigator.connection) {
info.push(`Speed: ${navigator.connection.downlink} MB/s`);
}
}
Run Code Online (Sandbox Code Playgroud)
但类型只包含type
属性。尽管当我在控制台中打印该对象时,它具有我期望的所有属性:
我应该怎么做才能克服打字稿错误?
类型“NetworkInformation”上不存在属性“downlink”。ts(2339)
我按照这些资源设置了 GitHub Actions 工作流程来构建、测试 dotnet 库并将其发布到 GitHub 包:
这些文章确实很有帮助,但是我遇到了一个他们都没有讨论的问题:
将 MagicLibrary.0.1.3.nupkg 推送到“https://nuget.pkg.github.com/vivere-dally”... PUT https://nuget.pkg.github.com/vivere-dally/ warn :您的请求无法通过 GitHub Packages 服务进行身份验证。请确保您的访问令牌有效并且配置了适当的范围。禁止https://nuget.pkg.github.com/vivere-dally/ 218ms 错误:响应状态代码不表示成功:403(禁止)。
这是我的工作流程文件:
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 …
Run Code Online (Sandbox Code Playgroud) typescript ×3
azure ×2
github ×2
material-ui ×2
reactjs ×2
asp.net ×1
asp.net-core ×1
azure-cli ×1
c# ×1
composition ×1
dataframe ×1
devops ×1
docker ×1
inheritance ×1
jenkins ×1
jss ×1
julia ×1
navigator ×1
nuget ×1
three.js ×1
uml ×1