小编Sah*_*rma的帖子

如何使javascript scrollIntoView顺利?

在一个反应​​应用程序中,我有一个方法被调用以将特定节点带入视图,如下所示.

scrollToQuestionNode(id) {
        const element = document.getElementById(id);
        element.scrollIntoView(false);
}
Run Code Online (Sandbox Code Playgroud)

滚动很好,但滚动动作有点不稳定.我怎样才能让它顺利?我没有看到任何我可以为scrollIntoView提供的选项.

javascript css scroll reactjs

32
推荐指数
3
解决办法
4万
查看次数

webpack无法导入图像(在打字稿中使用express和angular2)

我无法在headercomponent.ts中导入图像.我怀疑这是因为我在编译ts(使用webpack ts loader)时出错了,因为同样的事情与react(其中组件是用es6编写的)一起工作

错误位置是

//headercomponent.ts
import {Component, View} from "angular2/core";
import {ROUTER_DIRECTIVES, Router} from "angular2/router";
import {AuthService} from "../../services/auth/auth.service";
import logoSource from "../../images/logo.png"; //**THIS CAUSES ERROR**  Cannot find module '../../images/logo.png'

@Component({
    selector: 'my-header',
    //templateUrl:'components/header/header.tmpl.html' ,
    template: `<header class="main-header">
  <div class="top-bar">
    <div class="top-bar-title">
      <a href="/"><img src="{{logoSource}}"></a>
    </div>
Run Code Online (Sandbox Code Playgroud)

我的webpack配置是

// webpack.config.js
'use strict';

var path = require('path');
var autoprefixer = require('autoprefixer');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var basePath = path.join(__dirname,'public');
//const TARGET = process.env.npm_lifecycle_event;
console.log("bp " + basePath)
module.exports …
Run Code Online (Sandbox Code Playgroud)

urlloader express typescript webpack angular

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

标签 统计

angular ×1

css ×1

express ×1

javascript ×1

reactjs ×1

scroll ×1

typescript ×1

urlloader ×1

webpack ×1