我正在使用Swiper for React来显示一些幻灯片。
我一直坚持使用外部按钮在幻灯片(上一张和下一张)之间导航。
Swiper 有一个useSwiper 钩子,可以提供对其 Swiper 实例 API 的编程访问。但这不起作用。
这是我的代码:
import { useSwiper } from 'swiper/react';
//more code
const swiper = useSwiper();
//more code
<Swiper
modules={[Navigation, Pagination, Scrollbar, A11y]}
navigation
spaceBetween={20}
slidesPerView={1}
>
<button onClick={() => swiper.slideNext()}>Slide</button>
{
ads.map(ad => <SwiperSlide>
slider explanation
</SwiperSlide>
)}
</Swiper>
Run Code Online (Sandbox Code Playgroud)
当我单击该按钮时,我收到此错误:
类型错误:无法读取 null 的属性(读取“slideNext”)
我有两个存储库。A和B。
在 A 里面,我有一个 docker 镜像。假设它的名字是ghcr.io/org/a
在 B 内部,我有一个想要使用这个包的操作。两个存储库都是私有的。
这是我的操作代码:
- name: Log in to GitHub Container Repository
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Pull the image
run: |
docker pull ghcr.io/org/a:latest
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我首先登录 ghcr.io 并收到消息Login succeeded。然后我想从我的其他存储库中提取图像。
但我收到这个错误:
来自守护程序的错误响应:被拒绝
但是,当我从自己的计算机登录 ghcr.io 时,我可以访问这两个存储库,并且可以从我的任何私有存储库中提取任何图像。
为什么B的GitHub Action登录后无法从A拉取镜像?
我在我的 React 应用程序中导入了material-ui,我可以更改复选框的颜色和大小,如您所见,但我无法更改图标 borderRadius,我应该怎么做?
import FormGroup from '@mui/material/FormGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
const CheckBox = () => {
return <div>
<FormGroup>
<StyledFormControlLabel
control={
<Checkbox
sx={{
'& .MuiSvgIcon-root': {
fontSize: 70,
borderRadius: 20
}
}}
/>
}
label="Villa"
/>
</FormGroup>
</div>
```
Run Code Online (Sandbox Code Playgroud)