简体   繁体   English

在 javascript 中使用情感/样式时出现服务器错误

[英]server error while using emotion/styled in javascript

import Link from "next/link";
import Image from "next/image";
import { Text, useColorModeValue } from "@chakra-ui/react";
import { styled } from "@emotion/styled"

const LogoBox = styled.span`
font-weight: bold;
font-size: 18px;
display: inline-flex;
align-items:center;
height: 30px;
line-height:20px;
padding:10px

&:hover img {
    transform:rotate(20deg);
}`


const Logo = () => {
    const dragonImg = `/images/dragon${useColorModeValue('', '-dark')}.png`
    return (
        <Link href="/">
            <a>
                <LogoBox>
                    <Image src={dragonImg} width={20} height={20} alt="logo" />
                    <Text 
                    color={useColorModeValue('gray.800', 'whiteAlpha.900')}
                    fontFamily="M PLUS Rounded 1c"
                    fontWeight={bold}
                    ml={3}> pokmon</Text>
                </LogoBox>
            </a>
        </Link>
    )
}



export default Logo;

In the above code, I'm using emotion styled to add style in span, however when running the site, I'm newbie and don't know what the issue here is, can anyone please describe me what the issue is, and how can I solve it.在上面的代码中,我使用情感样式在跨度中添加样式,但是在运行站点时,我是新手,不知道这里的问题是什么,谁能描述一下问题是什么,以及如何我能解决吗?

enter image description here在此处输入图像描述

导入时不需要提取styled

import styled from "@emotion/styled"

Run your code, open your dev tools on chrome and go to console.运行您的代码,在 chrome 上打开您的开发工具,然后转到控制台。 It should give you a description of your issue and you should be able to solve it using google.它应该给你一个问题的描述,你应该能够使用谷歌解决它。 On the other hand if you need help you should provide us with a clear issue and what you have tried to do to solve it.另一方面,如果您需要帮助,您应该向我们提供一个明确的问题以及您为解决该问题所做的尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM