小编l00*_*00k的帖子

Vue CLI源映射以样式化vue组件文件的一部分

我正在玩Vue CLI项目。我已经配置了启动项目,设置了一些开发更改,例如:

package.json

"dependencies": {
    "bootstrap": "^4.3.1",
    "core-js": "^3.0.1",
    "preload-it": "^1.2.2",
    "register-service-worker": "^1.6.2",
    "vue": "^2.6.10",
    "vue-router": "^3.0.3",
    "vuetify": "^1.5.14",
    "vuex": "^3.1.1"
},
"devDependencies": {
    "@vue/cli-plugin-babel": "^3.7.0",
    "@vue/cli-plugin-pwa": "^3.7.0",
    "@vue/cli-service": "^3.7.0",
    "fontello-cli": "^0.4.0",
    "node-sass": "^4.9.0",
    "sass-loader": "^7.1.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "vue-cli-plugin-vuetify": "^0.5.0",
    "vue-template-compiler": "^2.5.21",
    "vuetify-loader": "^1.2.2"
}
Run Code Online (Sandbox Code Playgroud)

vue.config.js

module.exports = {
    configureWebpack: {
        devtool: process.env.NODE_ENV === 'development'
            ? 'inline-source-map'
            : false,
    },
    css: {
        sourceMap: process.env.NODE_ENV === 'development'
    }
}
Run Code Online (Sandbox Code Playgroud)

babel.config.js

module.exports = {
    presets: [
        [
            '@vue/app',
            { useBuiltIns: …
Run Code Online (Sandbox Code Playgroud)

javascript source-maps webpack vue.js

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

WebGL:将spritebatch渲染为渲染纹理时的奇怪行为

技术:WebGL/GL

  1. 当我立即将10k精灵(使用spritebatch)渲染到后台缓冲区时,一切正常.

10K

好

  1. 当我将其渲染为渲染纹理时,我会遇到一些奇怪的alpha混合问题(我猜...).在纹理具有透明像素的地方,alpha被错误地计算(IMO应该是累积的).

10K

bad1

1K

BAD2

200黑色背景

bad3

混合配置:

gl.enable(gl.BLEND);
gl.blendEquation(gl.FUNC_ADD);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
Run Code Online (Sandbox Code Playgroud)

这是我创建渲染缓冲区的方法:

this._texture = this.gl.createTexture();
this.gl.bindTexture(this.gl.TEXTURE_2D, this._texture);
this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.width, this.height, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null);

this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);


this.renderBuffer = this.gl.createFramebuffer();

this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this.renderBuffer);
this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER, this.gl.COLOR_ATTACHMENT0, this.gl.TEXTURE_2D, this._texture, 0);
Run Code Online (Sandbox Code Playgroud)

javascript webgl

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

你能在HTML5中定义自己的自闭标签吗?

我已经读过这个话题,但我还是有疑问.有没有办法定义void标签?

我试过这个:

<icon class="home"/> (know that slash isn't obligatory)
Run Code Online (Sandbox Code Playgroud)

但是,如果在此标记FF关闭它们之后有任何文本内容.

<icon class="home"/> Go home
Run Code Online (Sandbox Code Playgroud)

使

<icon class="home">Go home</icon>
Run Code Online (Sandbox Code Playgroud)

我应该定义哪个标签是void-element?或者HTML5无法做到这一点?

tags html5

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

Cpp如何关闭特定的显示器?

我知道如何关闭所有显示器

SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
Run Code Online (Sandbox Code Playgroud)

但我想只转一个.

c++ winapi

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

包含带有特殊字符的字段的 JavaScript 解构对象

我有数组(API 响应):

let arr = [
    { '@type': 'Something', data: 1234 },
    { '@type': 'Something', data: 3214 },
]
Run Code Online (Sandbox Code Playgroud)

是否可以使用那些“@”前缀字段来解构元素?

for (const { data, ??? @type } of arr) {}
Run Code Online (Sandbox Code Playgroud)

javascript destructuring

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

SDL2 AntiAliasing

使用SDL_RenderCopyEx时,如何在SDL2中打开抗锯齿功能?

我发现一些建议使用的文章:

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
Run Code Online (Sandbox Code Playgroud)

glEnable(GL_MULTISAMPLE);
Run Code Online (Sandbox Code Playgroud)

但这没有任何效果.有任何想法吗?

int Buffers, Samples;
SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &Buffers );
SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &Samples );
cout << "buf = " << Buffers << ", samples = " << Samples;
Run Code Online (Sandbox Code Playgroud)

回报

buf = -858993460,samples = -858993460.

编辑:代码:

   #include <windows.h>
#include <iostream>

#include <SDL2/include/SDL.h>
#include <SDL2/include/SDL_image.h>

using namespace std;


int main( int argc, char * args[] )
{
    // Inicjacja SDL'a
    SDL_Init(SDL_INIT_EVERYTHING);

    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8);

    SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); 

    // Tworzenie okna
    SDL_Window *win = nullptr;
    win = …
Run Code Online (Sandbox Code Playgroud)

c++ opengl sdl antialiasing

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

Magento 2.0如何在观察者中重定向

我已经为controller_action_postdispatch事件声明了观察者.在excecute方法中,我检查客户是否已登录.如果不是,则应将其重定向到登录页面.

public function execute(\Magento\Framework\Event\Observer $observer)
{
  # check if user is logged in
  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $customerSession = $this->objectManager->get('Magento\Customer\Model\Session');

  if(!$customerSession->isLoggedIn())
  {
    $request = $this->objectManager->get('Magento\Framework\App\Request\Http');

    if(strpos($request->getPathInfo(), '/customer/account/') !== 0)
    {
       # redirect to /customer/account/login
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

如何将客户端重定向到另一个URL?

php magento2

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

MSVC 14 STL矢量储备

我注意到MSVC 14 Comm上的奇怪行为(IMO).在Debug x86解决方案中.下面的代码在不包含vector :: resize时抛出异常.注意:在分配之后,可以通过传递nullptr来取消分配某些实体.

vector<Entity*> m_entities;

(...)

// find empty slot
u_int id = m_entities.size();
for(u_int i=0; i<m_entities.size(); ++i)
{
    if(m_entities[i] == nullptr)
    {
        id = i;
        break;
    }
}

// vector realloc
if(id == m_entities.capacity())
{
    u_int newSize = m_entities.capacity() * 2;
    m_entities.reserve(newSize);
    //m_entities.resize(newSize);
}

// assign
entity->m_id = id;
m_entities[id] = entity;
Run Code Online (Sandbox Code Playgroud)

例外 调试

看起来operator []检查size()而不是capacity() - 我是对的吗?

c++ stl

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

PHP乘法

这是我的第一个问题,所以大家好..

有可能满足这个条件吗?其中$ a和$ b是一些已定义的变量

if(!is_numeric($a * $b.'')) { ... }
Run Code Online (Sandbox Code Playgroud)

编辑:第二个条件

$a * $b can't be INF
Run Code Online (Sandbox Code Playgroud)

php string multiplication

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