小编You*_* L.的帖子

Webpack 不会编译带有背景图像的 SASS

我在编译 SASS 代码时遇到问题。\n我想使用背景图像,但当我尝试此操作时,我的所有 css 都停止工作。

\n\n

我的 SASS 文件看起来像这样

\n\n
@import "~bootstrap/scss/bootstrap";\n@import "constants";\n\n#crossroad {\n  position:relative;\n  background-image: url("../assets/bg.jpg");\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的 Webpack.config

\n\n
const path = require(\'path\');\n\nmodule.exports = {\n  entry: \'./src/app.js\',\n  output: {\n    filename: \'bundle.js\',\n    path: path.resolve(__dirname, \'dist\')\n  },\n  mode: "development",\n  module: {\n    rules: [\n      {\n        test: /\\.(scss|png|jpg)$/,\n        use: [\n          {\n            // Adds CSS to the DOM by injecting a `<style>` tag\n            loader: \'style-loader\'\n          },\n          {\n            // Interprets `@import` and `url()` like `import/require()` and will resolve them\n            loader: \'css-loader\'\n          },\n          {\n            // …
Run Code Online (Sandbox Code Playgroud)

javascript sass node.js npm webpack

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

如何在js中过滤HTMLCOLLECTION?

嗨,我在过滤 HTML 集合时遇到问题。我获得了类列表作为 html 集合。其中一类具有 .active 类。我需要从此列表中删除所有其他类,并在活动类之后只留下下一个类。请问怎么做呢?

我的清单示例:

HTMLCollection []
0: div.chapter-list-item.seen
1: div.chapter-list-item.seen
2: div.chapter-list-item.seen
3: div.chapter-list-item.seen
4: div.chapter-list-item.active.seen
5: div.chapter-list-item.seen
6: div.chapter-list-item.seen
7: div.chapter-list-item.seen
8: div.chapter-list-item.
Run Code Online (Sandbox Code Playgroud)

我的代码:

let allChaptersItems= document.getElementsByClassName("chapter-list-item");
let activeChapter = document.getElementsByClassName("active");
console.log(activeChapter);
console.log(allChaptersItems);
Run Code Online (Sandbox Code Playgroud)

javascript

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

如何在反应中加载图像并转换为 blob

嗨,我有反应问题。我有一个方法,点击后开始导入图像。实际上,我在我的文件输入上使用了这种方法的 onChangeevent:

fileUploadInputChange(e) {
  console.log(e.target.value); // return url of image like C:\fakepath\pokemon-pikachu-wall-decal.jpg
};
Run Code Online (Sandbox Code Playgroud)

现在我必须将此上传的文件转换为 blob。请问我该怎么做?

我的其他代码如下所示:

export class GeneralySettings extends Component {
    /**
     * PropTypes fot component
     * @return {object}
     */
    static get propTypes() {
        return {
            userData: PropTypes.object.isRequired,
        };
    };

    constructor(props) {
        super(props);
        this.state = {
            showAvatarChangeButton: false,
            uploadedImage : '',
        };
        this.inputReference = React.createRef();

    }

    fileUploadAction(){
        this.inputReference.current.click();
    };

    fileUploadInputChange(e){
            console.log(e.target.value);
        };


    /**
     * Render method for user profile
     * @return {*}
     */
    render() {
        return (

                        <div className={'d-flex …
Run Code Online (Sandbox Code Playgroud)

html javascript image reactjs

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

如何正确使用道具打开/关闭类星体中的对话框?

嗨,我坚持使用类星体对话框处理事件。首先,我有一个对话框组件(对于 cookie,用户可以单击两个按钮 - 一个用于接受 cookie,一个用于显示更多)。\n当用户单击“显示更多”时,它应该打开下一个对话框,其中包含一些基本文本和几个按钮(即对于这个问题并不重要)。

\n

所以第一个对话框是父对话框,第二个对话框是子对话框。我尝试在父级中创建引用(isOpen = true)并将其发送给子级。问题是道具是只读的,当我单击对话框外部的屏幕时,我收到了有关它的警告。这是因为有隐藏对话框的本机操作(我需要此操作保持工作状态)所以我可以\xc2\xb4t这样做:/

\n

我真的在这件事上停留了很长时间,所以感谢您的帮助:/

\n

家长

\n
<template>\n  <q-dialog :model-value='props.showCookies' position='bottom' persistent>\n    <q-card style='max-width: 1920px; width:100%; background-color: rgba(77,80,83,0.9490196078431372 )'>\n      <q-card-section>\n        <div>\n           ....\n          <div class='flex' style='justify-content: right'>\n            <!-- This is the button to open dialog-->\n            <q-btn rounded color='grey-5' label='Zjistit v\xc3\xadce' class='cookie-button q-mr-sm' @click='showMore' />\n            <q-btn rounded color='grey-5' label='Povolit v\xc5\xa1e' class='cookie-button' @click='acceptCookies' />\n          </div>\n        </div>\n      </q-card-section>\n    </q-card>\n  </q-dialog>\n  <CookiesDialogWhichWeUse :isOpen='isOpenCookieSettingsWhichWeUse' />\n</template>\n\n<script lang='ts'>\nimport { SetupContext, ref } from 'vue';\nimport CookiesDialogWhichWeUse from '@/components/Cookies/CookiesDialogWhichWeUse.vue';\n\nexport default {\n  name: 'CookiesModal',\n …
Run Code Online (Sandbox Code Playgroud)

javascript typescript vue.js quasar-framework vue-composition-api

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