小编Ton*_*ler的帖子

在SASS中加号的含义是什么?

我正在阅读bulma的代码,我无法理解SCSS中变量前面的"+"的编号

这是使用"+"符号的代码段:

  +mobile
    &.is-narrow-mobile
      flex: none
    &.is-full-mobile
Run Code Online (Sandbox Code Playgroud)

那是什么?

sass

11
推荐指数
1
解决办法
3014
查看次数

动态(单击)功能 - Angular2

将动态函数绑定到click事件时遇到一些麻烦.请看下面: -

档案1

<title-bar [actions]='[{title: "Create A New Plan", link: "hello"}]' ></title-bar>
Run Code Online (Sandbox Code Playgroud)

档案2

<div class="actions" *ngIf="actions">
    <a *ngFor="let action of actions" class="ui primary button" (click)="[action.link]()">{{action.title}}</a>
</div>
Run Code Online (Sandbox Code Playgroud)

除了在(点击)中绑定action.link之外,所有代码都完美无缺.

如果我创建以下按钮: -

<button (click)="hello()"></button>
Run Code Online (Sandbox Code Playgroud)

它应该调用hello()函数.但由于某种原因,我无法动态地使用它.

有没有人有一个简单的解决方案,我可能已经看过了?

该函数只是为了测试而调用一个简单的警报: -

public hello() {
    alert('test');
}
Run Code Online (Sandbox Code Playgroud)

我试图将点击事件更改为以下但没有任何乐趣: -

(click)="action.link"
(click)="[action.link]()"
(click)="this[action.link]()"
Run Code Online (Sandbox Code Playgroud)

我分别得到以下错误: -

No error, but not function called
inline template:3:2 caused by: ["hello"] is not a function
inline template:3:2 caused by: self.parentView.parentView.context[self.context.$implicit.link] is not a function
Run Code Online (Sandbox Code Playgroud)

任何帮助推动正确方向的人都将非常感激.

angular

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

Angular 2 - 子路由加载父组件

我试图让我的路由在我的Angular 2应用程序中工作.

这是我在app.routes.ts文件中使用的代码

export const ROUTES: Routes = [
  { path: '',      component: PublicComponent, data: { title: 'Heroes List' } },
  { path: 'home',  component: PublicComponent },
  { path: 'admin',  component: PrivateComponent, children: [
    { path: '', component: PrivateComponent },
    { path: 'account-settings', component: AccountSettingsComponent, children: [
      { path: '', component: UserInformationComponent},
      { path: 'user-information', component: UserInformationComponent},
      { path: 'companys-information', component: CompanysInformationComponent}
    ] },
  ] },
  { path: '**',    component: NoContentComponent },
];
Run Code Online (Sandbox Code Playgroud)

每当我尝试导航到其中一个子路由时,它就会加载父路由.

所以我要说比较一下: -

http://localhost:4200/#/admin

它会引入正确的组件PrivateComponent. …

routing angular-cli angular

5
推荐指数
2
解决办法
6216
查看次数

Angular 2 Setter和Getter

我正在尝试创建一个服务来将数据解析到不同路由上的不同组件.

如果我在同一个组件上调用follow服务,我会得到我需要的结果,但如果我尝试从另一个组件获取设置结果,则服务返回undefined.

这是我的服务: -

import {Injectable} from '@angular/core';

@Injectable()
export class TestService {

  public _test:any;

  set test(value:any) {
    this._test = value
  }

  get test():any {
    return this._test;
  }
}
Run Code Online (Sandbox Code Playgroud)

我设置的服务如下: -

this.testService.test = 3;
Run Code Online (Sandbox Code Playgroud)

我使用以下内容在组件中收到服务数据: -

console.log(this.testService.test)
Run Code Online (Sandbox Code Playgroud)

如前所述,如果我在同一个组件内进行通信,那么这个工作绝对没问题,我有相同的导入,提供者和构造函数.

另外,请注意组件是兄弟组件

是否有人能够帮助或指出我正确的方向,我们将非常感激.

如果您需要任何额外的代码,请告诉我.

components getter-setter typescript angular

5
推荐指数
1
解决办法
1万
查看次数

Woocommerce aJax 将优惠券代码应用于购物篮

我试图通过按下按钮将优惠券代码应用于购物篮。我有以下代码:-

coupon = jQuery(this).data('coupon');
data = {coupon_code : coupon};
jQuery.post( "?wc-ajax=apply-coupon", { coupon_code: coupon }).done(function( data ) {
    alert( "Data Loaded: " + data );
});
Run Code Online (Sandbox Code Playgroud)

我可以看到以下数据正在解析到服务器:-

coupon_code: 10percentdiscount
Run Code Online (Sandbox Code Playgroud)

10percentdiscount存在。

一旦我发送了请求,服务器就不会发回响应。

我是正确提出这个要求还是有其他方法?

先感谢您。

php ajax wordpress woocommerce

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

ssh2-sftp-client获取请求node.js

我目前正在尝试使用ssh2-sftp-client从FTP服务器下载文件。

我可以看到文件列表,如下面的代码所示,我的问题是下载文件时。

从下面的代码中可以看到,我正在尝试使用sftp.get获取文件的内容以及节点文件系统来创建文件。

保存文件时,不保存服务器上文件的内容,仅保存[object Object]

var Client = require('../../node_modules/ssh2-sftp-client');
var sftp = new Client();
var root = '/files';
var fs = require('fs');

sftp.connect({
  host: '192.168.0.1',
  port: '22',
  username: 'user',
  password: 'password'
}).then(() => {
  return sftp.list(root);
}).then((data) => {
  for( var i = 0, len = data.length; i < len; i++) {
    console.log(data[i].name);
    var name = data[i].name;
    sftp.get(root+'/'+name).then((file) => {
      console.log(file);
      fs.writeFile('downloads/'+name, file, function(err) {
      if(err) {
        return console.log(err);
      }
      console.log("The file was saved!");
    });
  })      }
}).catch((err) => { …
Run Code Online (Sandbox Code Playgroud)

javascript node.js

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

Nativescript iOS-命令xcodebuild失败,退出代码为null

我通过运行以下命令设置了新的nativescript应用:

tns create application --ng
Run Code Online (Sandbox Code Playgroud)

当我尝试使用以下方式启动应用程序时:

tns run ios --emulator
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Unable to apply changes on device: BC7714A3-A8B0-4CEC-A7A4-D54563CF04EE. Error is: Command xcodebuild failed with exit code null.
Run Code Online (Sandbox Code Playgroud)

完整的错误是:-

Searching for devices...
Executing before-liveSync hook from /XXXXXX/Desktop/Bike/hooks/before-liveSync/nativescript-angular-sync.js
Skipping prepare.
Building project...
Xcode build...
2018-04-30 21:49:36.684 xcodebuild[1674:27197] [MT] DVTAssertions: ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-13756/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/RuntimeSupport/MacroExpansion/XCMacroExpansionExtensions.mm:94
Details:  Assertion failed: [value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSArray class]]
Object:   <DVTMacroDefinitionTable: 0x7fab68c72bb0>
Method:   -_xc_setValue:forMacroName:conditionSet:errorHandler:
Thread:   <NSThread: 0x7fab68d176a0>{number = 1, name = main}
Hints: 

Backtrace:
  0   -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in …
Run Code Online (Sandbox Code Playgroud)

javascript tns ios nativescript angular

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