在 Laravel 中安装 npm 包后如何要求它?
例如?我需要包sweetalert2,先安装它?
npm install --save sweetalert2
Run Code Online (Sandbox Code Playgroud)
现在,我需要\resources\assets\js\bootstrap.js在 laravel 的文件中要求它吗?
它的默认内容是这样的:
window._ = require('lodash');
try {
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
window.axios = require('axios');
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
Run Code Online (Sandbox Code Playgroud)
它看起来像lodash,jquery,bootstrap,axios被要求到laravel,但4句是不同的,他们是这样的:
window._ = require('lodash');
window.$ = window.jQuery = require('jquery');
require('bootstrap');
window.axios = require('axios');
Run Code Online (Sandbox Code Playgroud)
问题?
1?为什么这4个句子有差异?
2?我想要求包sweetalert2?我该怎么写?
我正在使用一个用于我在Ionic 2中开发的应用程序的信号插件,该插件正在运行.从OneSignal发送的消息显示在应用程序中,但是当我尝试获取播放器唯一ID时出现问题:
这是我用于显示消息的代码,此代码有效:
let notificationOpenedCallback = function(jsonData) {
let alert =alertCtrl.create({
title: jsonData.notification.payload.title,
subTitle: jsonData.notification.payload.body,
buttons: ['OK']
});
alert.present();
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
};
window["plugins"].OneSignal
.startInit("05d411f4-45da-4101-92a5-4a60e5c9fd03", "49543248748")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
Run Code Online (Sandbox Code Playgroud)
这段代码用于获取ID:
window["plugins"].OneSignal
.startInit("05d411f4-45da-4101-92a5-4a60e5c9fd03", "49543248748")
.endInit();
window["plugins"].OneSignal.getIds(function(ids){
firebase.database().ref('usuarios/'+ this.usuarioId).update({
idOnesignal: ids.userId
})
Run Code Online (Sandbox Code Playgroud)
这段代码不会运行
我有这样的功能,它只是上传带有 xhr 请求的图像:
public uploadAvatar(avatarFile, callback) {
return new Promise((resolve, reject) => {
let formData: any = new FormData();
let url = 'avatar';
let imgArr = "avatar";
let xhr = new XMLHttpRequest();
formData.append(imgArr, avatarFile, avatarFile.name);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
resolve(JSON.parse(xhr.response));
callback('success');
} else {
reject(xhr.response);
callback('error');
}
}
};
xhr.open("POST", environment.baseUrl + url, true);
xhr.setRequestHeader('Auth', this._auth.getToken());
xhr.send(formData);
});
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能返回 Observable insted Promise?
我试图在离子角3.3.0中创建Login/SignUp.我收到错误找不到模块'../providers/auth-service/auth-service'.在login.ts文件中.请帮忙!
AUTH-service.ts
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/map';
/*
Generated class for the AuthServiceProvider provider.
See https://angular.io/docs/ts/latest/guide/dependency-injection.html
for more info on providers and Angular 2 DI.
*/
export class User {
name: string;
email: string;
constructor(name: string, email: string) {
this.name = name;
this.email = email;
}
}
@Injectable()
export class AuthServiceProvider {
currentUser: User;
public login(credentials) {
if (credentials.email === null || credentials.password === null) {
return …Run Code Online (Sandbox Code Playgroud) 读Numpy快速教程,我无法理解这句话.
a = np.arange(12).reshape(3,4)
b1 = np.array([False,True,True])
b2 = np.array([True,False,True,False])
>>> a[b1,b2]
array([ 4, 10])
Run Code Online (Sandbox Code Playgroud)
为什么a[b1,b2]是array([4,10])不是array([[4,6],[8,10]])?
我有以下数组作为输入以降序排序值:
var cars = ["8587009748118224023Po","8587009748118224023PP","8587009748118224023P,","8587009748118224023P$","8587009748118224023P<","8587009748118224023P?"]
Run Code Online (Sandbox Code Playgroud)
在C#中,我正在使用OrderByDescending并获得以下输出
C#代码:
var rslt= cars.OrderByDescending(a => a);
Run Code Online (Sandbox Code Playgroud)
结果:
8587009748118224023PP,8587009748118224023Po,8587009748118224023P<,8587009748118224023P?,8587009748118224023P,,8587009748118224023P$
Run Code Online (Sandbox Code Playgroud)
在Javascript中,我使用排序和反向并获得以下不同的结果
javascript代码:
cars.sort();
cars.reverse();
Run Code Online (Sandbox Code Playgroud)
结果:
8587009748118224023Po,8587009748118224023PP,8587009748118224023P?,8587009748118224023P<,8587009748118224023P,,8587009748118224023P$
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我如何在C#中对值进行排序,就像javascript一样?
npm start我在使用角度页面时收到以下错误。
C:\TPO\Client\Angular>ng serve
Your global Angular CLI version (1.3.2) is greater than your local
version (1.0.4). The local Angular CLI version is used.
To disable this warning use "ng set --global warnings.versionMismatch=false".
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **
10% building modules 4/4 modules 0 active
<--- Last few GCs --->
118169 ms: Mark-sweep 1348.4 (1404.3) -> 1348.1 (1404.3) MB, 1338.9 / 0.0 ms [allocation failure] [GC in old space …Run Code Online (Sandbox Code Playgroud) API 调用需要什么
我需要通过 Jenkins 指标插件的 API 调用获得每个构建的时间线信息。我正在使用 Web API 来获取我的 jenkins 中的工作数据。然而,打电话$JenkinsUrl/metrics/APIkey却无济于事。知道如何获取这些信息吗?
我一直在尝试使用 Ionic 3 提供的 ionic-native 插件。当我阅读安装说明时,总是有 2 个命令行而不是一个。
ionic cordova plugin add cordova-plugin-camera
npm install --save @ionic-native/camera
Run Code Online (Sandbox Code Playgroud)
如果我没记错的话,ionic plugin add somepluginhere在过去,只有一个类似于 的命令就可以完成工作。
这里有什么区别?
我需要精确控制文本所占据的区域。我创建了最基本的程序,显示意外的顶部和底部间距被添加到文本中。这些额外的填充从哪里来?如何摆脱它?
@main
struct myApp: App {
init() { }
var body: some Scene {
WindowGroup {
Text("80")
.font(.system(size: 30, weight: .bold, design: .default))
.background(Color.red)
}
}
}
Run Code Online (Sandbox Code Playgroud)
angular ×3
javascript ×3
ionic2 ×2
ionic3 ×2
npm ×2
.net ×1
api ×1
asp.net ×1
c# ×1
ionic-native ×1
jenkins ×1
laravel-5 ×1
numpy ×1
observable ×1
onesignal ×1
python ×1
rxjs ×1
sorting ×1
swiftui ×1
swiftui-text ×1