小编Cel*_*els的帖子

CSS/SCSS 自定义工具提示效果

大家好,我正在尝试创建一个自定义工具提示,具有很酷的悬停效果。我在互联网上找到了一个代码,它几乎可以满足我的要求。下面是代码

.tooltip {
  position: relative;

  &__item {
    position: absolute;
    min-width: 100px;
    padding: 20px;
    visibility: hidden;
    opacity: 0;
    background: white;
    transition: all .250s cubic-bezier(0, 0, 0.2, 1);
    color: #484848;
    border: 1px solid #cecece;
    border-radius: 3px;
    font-weight: 500;
    box-shadow: 0 2px 1px #bcbcbc;
    z-index: 4;
    &:after {
      content: "";
      display: block;
      position: absolute;
      width: 0;
      height: 0;
      border-style: solid;
    }
  }

  &__initiator {
    cursor: pointer;
    z-index: 5;
  }

  &[data-direction="bottom"] {

    .tooltip__initiator:hover ~ .tooltip__item {
      transform: translate3d(-50%, 0, 0);
      visibility: visible;
      opacity: 1; …
Run Code Online (Sandbox Code Playgroud)

css sass

5
推荐指数
1
解决办法
2849
查看次数

当 URL 包含多个路径时,React Router 不工作

我正在使用webpack-dev-server进行开发并同样响应路由器。这是我的wepack配置。

const webpack = require('webpack');
const path = require('path');
const common = require('./common.config.js')
const merge  = require('webpack-merge')

const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CleanWebpackPlugin = require('clean-webpack-plugin')

module.exports = merge(common, {
    devtool: 'source-map',
    mode:'development',
    module: {
        rules: [
           {
                test: /\.(sa|sc|c)ss$/,
            use: [
                       {
                  // Adds CSS to the DOM by injecting a `<style>` tag
                  loader: 'style-loader'
                       },
                       {
                          // Interprets `@import` and `url()` like `import/require()` and will resolve them
                          loader: 'css-loader'
                   },
                   {
                          // Loader …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack react-router

2
推荐指数
1
解决办法
2131
查看次数

尝试将字符串转换为字典时json.loads(string)抛出json.decoder.JSONDecodeError


我正在使用requests库进行api调用。然后将json响应格式化为字符串,并作为结果的一部分发送到我的服务器,如代码片段所示:

def get_and_send(url, method):
     resp = requests.request(url=url, method=method, **kwargs)
     result = f'{{ "status_code":{resp.status_code}, "content":{resp.json()} }}'
     send_to_server(result)
Run Code Online (Sandbox Code Playgroud)

我打算将此结果从服务器上的字符串结果转换回字典对象。
我的问题是,当我用于json.loads(result)将字符串转换为字典对象时,它会引发以下错误

Exception in thread Thread-2: Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
File "/home/adipster/PycharmProjects/ScriptBackbone/ts_server/agent_thread.py", line 39, in run
    resp_data = self._task_formatter.format_response(response) # Formats the response
File "/home/adipster/PycharmProjects/ScriptBackbone/utils/task_formatter.py", line 26, in format_response
    response = self.get_dict_response(response.decode().strip())
File "/home/adipster/PycharmProjects/ScriptBackbone/utils/task_formatter.py", line 36, in get_dict_response
    raise exp
File "/home/adipster/PycharmProjects/ScriptBackbone/utils/task_formatter.py", line 34, in get_dict_response
    return json.loads(response)
File "/usr/lib/python3.6/json/__init__.py", line 354, …
Run Code Online (Sandbox Code Playgroud)

python json

1
推荐指数
1
解决办法
392
查看次数

标签 统计

css ×1

json ×1

python ×1

react-router ×1

reactjs ×1

sass ×1

webpack ×1