我想在我的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包.
我有一个使用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)
但问题是当我使用像它说的扩展时,它不会更新视图.
我有一个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)