小编koo*_*x00的帖子

每个附件我都需要附上pdf或word或jpg图标

在driveFiles中,我得到多个文件名。
对于每个附件,我都需要附加pdf或word或jpg图标,
因此我使用了substr和lastIndexOf获得了文件格式。
现在使用如果条件,我能够禁用一个文件的图标。
如果我测试多个文件,则不检查第二个文件if
我认为问题是由于first的return语句引起的if
你能告诉我如何修复多个文件吗?

{this.props.driveFiles.length > 0 ? 
  this.props.driveFiles.map(_driveFileKey => {
    var driveFormat = _driveFileKey.name.substr(
      _driveFileKey.name.lastIndexOf(".") + 1
    );
    console.log("filename--->", driveFormat);
    if (driveFormat === "pdf") {
      return (
        <div>
          {" "}
          <Icon icon={["fal", "file-pdf"]} />
          {_driveFileKey.name}
        </div>
      );
    } else if (driveFormat === "doc") {
      return (
        <div>
          {" "}
          <Icon icon={["fal", "file-word"]} />
          {_driveFileKey.name}
        </div>
      );
    } else if (driveFormat === "jpg") {
      return (
        <div>
          {" "}
          <Icon icon={["fal", "file-image"]} /> …
Run Code Online (Sandbox Code Playgroud)

javascript jsx reactjs

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

如何模糊AngularJS代码?

如何模糊AngularJS代码?我们尝试过gulp-obfuscate,但它不起作用.有人可以帮助我们吗?非常感谢!

我们这样做了

someModule.controller('MyController',[ '$scope', function($scope) {",

但是在成功获得这样的混淆代码之后

function H?????????E???????????_C?OM????????E???S??????????4() {
var H?????????E???????????_C?OM????????E???S??????????1, H?????????E???????????_C?OM????????E???S??????????2, H?????????E???????????_C?OM????????E???S??????????3;
...
H?????????E???????????_C?OM????????E???S??????????3 = H?????????E???????????_C?OM????????E???S??????????1 + H?????????E???????????_C?OM????????E???S??????????2;
return H?????????E???????????_C?OM????????E???S??????????3;
Run Code Online (Sandbox Code Playgroud)

}

app-52143d391a.js中的所有angularjs代码都没有用,它返回

Uncaught Error: [$injector:nomod] Module 'client' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Run Code Online (Sandbox Code Playgroud)

跑完之后

gulp.task('obfuscate', function () {
return gulp.src('../webapp/scripts/app-*.js')
    .pipe(ngAnnotate())
    .pipe(obfuscate())
    .pipe(gulp.dest('dist'));
Run Code Online (Sandbox Code Playgroud)

});

一切都好,并得到以下代码:

http://pan.baidu.com/s/1ntXuGbB
Run Code Online (Sandbox Code Playgroud)

然后运行以下错误:

Uncaught TypeError:  _ 206. _ 252 is not a …
Run Code Online (Sandbox Code Playgroud)

angularjs

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

标签 统计

angularjs ×1

javascript ×1

jsx ×1

reactjs ×1