如何在 NextJS 的新标签页中打开链接?我试过这个:
<Link href="https://twitter.com/" passHref>
<a target="_blank">
<div className={`${dark ? styles.iconTwitterWhite : styles.iconTwitter} mr-3`} />
</a>
</Link>
Run Code Online (Sandbox Code Playgroud)
它在新标签中打开链接,但我有一条ESLint消息说:
ESLint: The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles.
Run Code Online (Sandbox Code Playgroud)
还有另一种方法吗?
我用来expo-av显示视频。视频已播放Portrait,我正在尝试根据设备方向显示视频。我的代码是:
import { Video } from 'expo-av';
import * as ScreenOrientation from 'expo-screen-orientation';
import NavigationHelper from '../../../../Helpers/NavigationHelper';
export default class VideoScreen extends Component {
render() {
const { route } = this.props;
const { videoUri } = route.params;
if (!videoUri) {
NavigationHelper.back();
}
return (
<ScrollView style={styles.container}>
<Video
source={{ uri: videoUri }}
rate={1.0}
volume={1.0}
isMuted={false}
resizeMode={Video.RESIZE_MODE_CONTAIN}
shouldPlay
isLooping
useNativeControls
style={{ width: 300, height: 300, alignSelf: 'center' }}
onReadyForDisplay={() => { const naturalSize = ScreenOrientation.Orientation.PORTRAIT …Run Code Online (Sandbox Code Playgroud)