import Image from 'next/image'
...
<Image src="/emotion.svg" alt="emtion" width={50} height={50} />
Run Code Online (Sandbox Code Playgroud)
我想更改 中的 SVG 颜色next/image。
但在 CSS 中,
img {
fill="#ffffff"
}
Run Code Online (Sandbox Code Playgroud)
不管用。
我该如何解决这个问题?
在discord v14中,我尝试使用该messageCreate事件,但是,当用户在discord中键入消息后,message.content没有任何数据,如下所示:
Message {
channelId: '998889338475655188',
guildId: '948995127148425246',
id: '998925735668498433',
createdTimestamp: 1658232854526,
type: 0,
system: false,
content: '',
author: User
Run Code Online (Sandbox Code Playgroud)
我尝试四处搜索,但找不到任何解决该问题的方法,我使用的与不和谐相关的代码是:
import { Client, GatewayIntentBits, Partials } from "discord.js";
const bot = new Client({
'intents': [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildMessages
],
'partials': [Partials.Channel]
});
bot.on('messageCreate', async (message) => {
console.log(message);
});
bot.login(process.env.token1)
Run Code Online (Sandbox Code Playgroud)
有谁知道新更新出了什么问题或需要更改什么?
我正在尝试在这里创建一个像这张图片一样的 Bootstrap 侧边栏。
我已经查看了 react-bootstrap 和 Twitter Bootstrap 上的所有代码,但我还没有找到如何对此进行编码。基本上,如果他们在桌面上查看,我希望侧边栏可见,否则隐藏。
当页面上的内容上下滚动时,侧边栏应该保持静止。
我知道 HTML 图像的宽度和高度属性可以简单地通过<img src="Debian.jpg" style="height: 120px; width: 130px">.
我正在寻找的是,是否存在一个 CSS 属性,该属性只取一个值,%并根据该百分比缩放原始图像的宽度和高度。例如,如果高度和宽度Debian.jpg是1000x700与我指定50%在CSS属性然后将图像按比例缩小到500x350,因此纵横比被维持。
我很难在单独调整高度和宽度的同时保持图像的纵横比。如果这样的属性不存在,那么有什么方法可以保持纵横比并获得所需的图像尺寸?
我正在尝试在 Next.js 项目中使用 Tailwind CSS,但我无法将 Tailwind 类与 Next.js Image 组件一起使用。
这是我的代码:
<Image
src={img.img}
alt="Picture of the author"
width="200"
height="200"
className="bg-mint text-mint fill-current"
></Image>
Run Code Online (Sandbox Code Playgroud)
我想使用 Tailwind 类而不是Next.js 图像的heightandwidth属性。但我不能,因为它给我一个错误。此外,unsizedproperty 会引发另一个错误,指出它已被弃用。有什么解决办法吗?
当我使用该layout='fill'属性时,它只显示一张图片。如果我使用该unsized属性,则会显示以下错误。
我的Home页面通过以下方式将数据从我的strapicms 发送到我的PostSlider组件props
import React from "react";
import styles from './index.module.scss'
import { AxiosService } from '../utils/axios-service'
import PostSlider from '../components/postSlider/postSlider'
const Home = ({ posts }) => {
return (
<div id='contentsWrap' className={styles.dohandsWrap}>
<PostSlider home={true} posts={posts} />
</div>
)
}
export default Home
export async function getStaticProps() {
const axios = AxiosService.create()
const res = await axios.get('/archives', {
params: {
category: 'news',
display: true,
showDoson: true,
_limit: 5,
_sort: 'id:DESC'
}
})
return …Run Code Online (Sandbox Code Playgroud) 我尝试使用新的 Discord.js 版本编写机器人,但当我尝试登录时,它提示我此错误
/home/max/Schreibtisch/Discord Bots/Perplex/node_modules/discord.js/src/util/Util.js:279
if (!Object.hasOwn(given, key) || given[key] === undefined) {
^
TypeError: Object.hasOwn is not a function
at mergeDefault (/home/max/Schreibtisch/Discord Bots/Perplex/node_modules/discord.js/src/util/Util.js:279:17)
at new BaseClient (/home/max/Schreibtisch/Discord Bots/Perplex/node_modules/discord.js/src/client/BaseClient.js:25:20)
at new Client (/home/max/Schreibtisch/Discord Bots/Perplex/node_modules/discord.js/src/client/Client.js:43:5)
at Object.<anonymous> (/home/max/Schreibtisch/Discord Bots/Perplex/src/bot.js:26:16)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
Run Code Online (Sandbox Code Playgroud)
这是我的机器人代码
/home/max/Schreibtisch/Discord Bots/Perplex/node_modules/discord.js/src/util/Util.js:279
if (!Object.hasOwn(given, key) || given[key] === undefined) {
^
TypeError: Object.hasOwn is not a function
at mergeDefault (/home/max/Schreibtisch/Discord Bots/Perplex/node_modules/discord.js/src/util/Util.js:279:17)
at …Run Code Online (Sandbox Code Playgroud) 我有一个 Next.js 应用程序,我需要一个图像来填充其容器的整个高度,同时根据其纵横比自动确定其宽度。
我尝试了以下方法:
<Image
src="/deco.svg"
alt=""
layout="fill"
/>
Run Code Online (Sandbox Code Playgroud)
此代码段编译成功,但在前端,我看到以下错误:
错误:带有 src "/deco.svg" 的图像必须使用 "width" 和 "height" 属性或 "unsized" 属性。
这让我困惑,因为根据该文档,在这些属性不使用的时候需要layout="fill"。
在 Material UI 中,显示图像的组件具有图像参数。例如:
\n<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />\nRun Code Online (Sandbox Code Playgroud)\nNext.js v10 中有一个新的Image自动缩放图像的组件:\xc2\xa0https://nextjs.org/docs/api-reference/next/image\xc2\xa0
有人知道如何Image在 Material UI 中使用新组件吗?
我希望使用 Laravel API 部署 Next.js 应用程序。我使用 CRA 开发了 React 应用程序,在这些应用程序中,我使用 API 服务器来服务index.htmlCRA 作为应用程序的入口点。
但在 Next.js 中,开发后我知道它需要 Node.js 服务器来提供服务(这是我的错,没有注意到)。有一个选项next export可以构建 Next.js 应用程序的静态表示,并且它有一个index.html. 我index.html通过 Laravel API 作为应用程序的入口。它正在为页面提供服务,但只是一些静态内容。
我希望知道是否可以在没有任何节点服务器的情况下从单个 PHP 共享托管托管 aPI 和 Next 应用程序?如果是这样,怎么办?如果不是这样,有什么替代方案?
next.js ×6
nextjs-image ×5
javascript ×4
reactjs ×4
css ×3
discord ×2
discord.js ×2
html ×2
node.js ×2
api ×1
image ×1
laravel ×1
material-ui ×1
sidebar ×1
strapi ×1
tailwind-css ×1