小编Soh*_*aee的帖子

如何在create-react-app中使用jQuery依赖的插件

我想在我的React应用程序中使用bootstrap和其他jQuery插件(datepicker,carousel,...)create-react-app.

以下是我导入jQuery和bootstrap的方法:

import React, { Component } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import $ from 'jquery';
window.jQuery = window.$ = $;
import 'bootstrap/dist/js/bootstrap.min';
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

./src/App.js
  Line 5:  Import in body of module; reorder to top  import/first

Search for the keywords to learn more about each error.
Run Code Online (Sandbox Code Playgroud)

请注意,我不想使用react-bootstrap包.

import jquery npm webpack create-react-app

10
推荐指数
2
解决办法
6268
查看次数

更新v-for中使用的数组内的对象时的Vue js反应性问题

我有一个使用vue.js的应用程序.我在对象数组中使用v-for生成结果列表.当我更新数组中第n项内的对象时,使用下划线_.extend,项目视图不会更新.http://vuejs.org/guide/reactivity.html有一个解决此问题的方法,它表示使用_.extend,如下所示:

this.results.displayed[key] = _.extend({}, this.results.displayed[key], detail.items);
Run Code Online (Sandbox Code Playgroud)

但问题是当我使用像它说的扩展时,它不会更新视图.

javascript arrays javascript-objects underscore.js vue.js

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

Vue js v-for not working

我有一个Vue js应用程序.我通过ajax获得一个列表:

    $.ajax({
    method: 'POST',
    dataType: 'json',
    url: this.base_info.url + 'getavailability?token=' + this.token,
    data: this.search_info,
    success: function (list) {
        this.results = list;
        console.log(list);
    }.bind(this)
});
Run Code Online (Sandbox Code Playgroud)

这是结果:

{
  "success": "true",
  "error": "false",
  "items": [
    {
      "relation_id": "9961",
      "recommendation_id": "1",
      "combination_id": "3",
      "total_fare": "5530000",
      "quantity_adult": "1",
      "totalfare_adult": "5,530,000",
      "quantity_child": "0",
      "totalfare_child": "0",
      "quantity_infant": "0",
      "totalfare_infant": "0",
      "airlines_name": "Qatar Airways",
      "airline_logo": "QR"
    },
    {
      "relation_id": "9962",
      "recommendation_id": "1",
      "combination_id": "4",
      "total_fare": "5530000",
      "quantity_adult": "1",
      "totalfare_adult": "5,530,000",
      "quantity_child": "0",
      "totalfare_child": "0",
      "quantity_infant": "0",
      "totalfare_infant": …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery vue.js

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