小编Edr*_*ric的帖子

我如何更改 material.io Web 组件填充颜色 (mdc-top-app.bar)

我一直在研究用于网络的谷歌材料设计,并且对SASS. 就目前而言,我一直在尝试更改mdc-top-app-bar使用fill-color($color)框架中提供的 sass mixin的背景颜色。

试过这几行

@use '@material/button/mdc-button';
@use '@material/button';
@use "@material/top-app-bar/mdc-top-app-bar";
@use "@material/icon-button/mdc-icon-button";

.mdc-top-app-bar {
    @include mdc-top-app-bar.fill-color(#8e44ad);
}
Run Code Online (Sandbox Code Playgroud)

显示以下错误消息

ERROR in ./app.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined mixin.
   ?
10 ?     @include mdc-top-app-bar.fill-color(#8e44ad);    
   ?     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
Run Code Online (Sandbox Code Playgroud)

sass material-components-web

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

如何修复 RichEmbed?

我试图在不和谐中打印 get embed 消息,但发生了这种情况:

类型错误:Discord.RichEmbed 不是构造函数

这是我的代码:

const Discord = require('discord.js');
const bot = new Discord.Client();
const token = 'mytokenhere';
const prefix = '!';

bot.on('ready', () => {
    console.log('This bot is online!');
});

bot.on('message', message => {
    let args = message.content.substring(prefix.length).split(" ");

    switch(args[0]) {
        case 'pomoc':
            message.channel.send('.')
            break;
        case 'cc':
            if(!args[1]) return message.reply('Podaj 2 argument! (liczbe wiadomosci do skasowania)')
            message.channel.bulkDelete(args[1]); 
            break;
        case 'embed':
            var embed = new Discord.RichEmbed()
                .setAuthor(message.author.username)
                .setDescription("Usuario rikolino.")
                .setColor("#3535353")
                .addField("Usuario", '${message.author.username}#${message.author.discriminator}')
                .addField("ID", message.author.id)
                .addField("Creación", message.author.createdAt);

            message.channel.send({embed});
            break; …
Run Code Online (Sandbox Code Playgroud)

javascript discord discord.js

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

提交后角度材料重置表单

我使用有角度的材料,并且有一个带有反应验证的表单。

\n\n

我想在提交后重置我的表单,我的问题是提交后我看到我的错误出现在表单中。

\n\n

输入示例:

\n\n
<mat-form-field>\n  <mat-label>Pr\xc3\xa9nom</mat-label>\n  <input matInput name="prenom" formControlName="prenom">\n  <mat-error *ngIf="f.prenom.hasError(\'required\') && submitted">\n    Ce champ est obligatoire\n  </mat-error>\n  <mat-error *ngIf="f.prenom.errors?.maxlength && !f.prenom.hasError(\'required\')">\n    le pr\xc3\xa9nom ne peut pas d\xc3\xa9passer 20 caract\xc3\xa8res\n  </mat-error>\n</mat-form-field>\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试添加提交的变量和 this.myForm.markAsUntouched() 但不起作用

\n\n
onSubmit() {\n  this.submitted = true;\n  if (this.myForm.invalid) {\n    return;\n  }\n  alert(\'Form Submitted succesfully!!!\\n Check the values in browser console.\');\n  console.table(this.myForm.value);\n  this.submitted = false;\n  this.myForm.reset();\n  this.myForm.markAsUntouched();\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

使用提交的变量,我看到消息错误消失(下面的黄色部分),但边框和红色没有消失。

\n\n

在此输入图像描述

\n\n

你们有什么想法来解决这个问题吗?

\n

javascript validation submit angular-material

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

使用curl时Github API错误“解析JSON时出现问题”但与Postman一起工​​作正常

我正在尝试使用 Github 的 API 创建一个版本。

我的请求在 Postman 中工作正常,但无论我尝试什么,curl 总是失败,包括如果我只是使用 Postman 将 Postman 请求转换为curl。

这是我的 Postman POST 请求的正文:

{
    "tag_name": "4.2.0",
    "target_commitish": "master",
    "name": "4.2.0",
    "body": "test"
}
Run Code Online (Sandbox Code Playgroud)

我已经包含了一个“Basic”类型的授权标头,我在其中输入我的用户名和为此目的创建的令牌。
我正在执行针对 的请求https://api.github.com/repos/<myUsername>/<myRepo>/releases

正如我所说 - 它工作正常,但是当我将其转换为 curl 时,我收到错误“解析 JSON 时出现问题”。

翻译后的curl命令是:

curl --location --request POST 'https://api.github.com/repos/<myUsername>/<myRepo>/releases' \
--header 'Authorization: Basic <someHashOrSomething>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "tag_name": "4.2.0",
    "target_commitish": "master",
    "name": "4.2.0",
    "body": "test"
}'
Run Code Online (Sandbox Code Playgroud)

我将其重新格式化curl --location --request POST 'https://api.github.com/repos/<myUsername>/<myRepo>/releases' --header 'Authorization: Basic <someHashOrSomething>' --header 'Content-Type: application/json' --data-raw …

json curl github github-api

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

如何在“TextInputLayout”的右端动态添加一个drawable?

我正在尝试制作类似以下示例的内容:

带有复选后缀图标的用户名文本字段的屏幕截图

我希望在我从服务器验证用户名时显示可绘制对象。

我正在使用 Material Design 文本输入字段和 EditText。是的,我可以使用 simpleEditText和 an 来完成ImageView,但我想使用标准元素。

我查看了官方文档,有一种方法可以使用XML在右上角添加图像,但我想以编程方式添加它。

android android-edittext android-textinputlayout material-components-android

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

图像视图/GIF重叠的Android涟漪效果

我在回收视图中有一个列表项,我想在整个元素上获得涟漪效果 - 目前我的 GIF 与涟漪重叠。我不知道如何解决这个问题,经过研究已经尝试了很多方法,但没有任何效果。

非工作涟漪效应的例子

这是我构建每个列表项所基于的特定 XML 文件。

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/selector"
android:clickable="false">

<pl.droidsonroids.gif.GifTextView
    android:layout_width="84dp"
    android:layout_height="84dp"
    android:paddingTop="3dp"
    android:paddingBottom="3dp"
    android:paddingRight="1dp"
    android:paddingLeft="1dp"
    android:background="@drawable/a_present_for_you"
    />

<TextView
    android:id="@+id/textView"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:textColor="@color/black"
    android:textSize="16sp"
    android:gravity="center_vertical"
    android:drawableRight="@drawable/ic_lock_open_blue_24dp"
    android:drawablePadding="16dp">
</TextView>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

android imageview ripple

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

如何从布局中引用颜色

这是我的styles.xml 文件

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">#6d3655</item>
    <item name="colorPrimaryDark">#442142</item>
    <item name="colorAccent">#de8573</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Run Code Online (Sandbox Code Playgroud)

我想从我的布局访问 colorPrimary。例如,我尝试将颜色应用于某些 TextField。我将“textColor”属性设置为“@style/AppTheme.colorPrimary”,但它不起作用。为什么?

layout android

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

防止 Android 中的材质按钮升起

如您所知,API+21 中的按钮在您触摸时会升起。根据文档,您不应将此类按钮放置在对话框或其他凸起界面中。我尝试将海拔设置为 0 或 1 但无济于事。我只是希望按钮具有连锁反应而不升高。我怎样才能做到这一点?

<Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:elevation="0dp"
            android:clickable="true"/>
Run Code Online (Sandbox Code Playgroud)

android

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

在模式对话框中编辑表单数据

请帮我修复下面描述的错误。

I am having the list of data in a table which on edit displays a dialog as shown in the screenshots: 截图1 截图2

I am Passing an id with my dialog openDialogEdit().

<button md-mini-fab class="example-fab" color="primary" (click)= "openDialogEdit(role.id);">
Run Code Online (Sandbox Code Playgroud)

RolesComponent(MdDialog):

export class RolesComponent implements OnInit {
    @Input() role: Role;
    @Output() roleDeleted = new EventEmitter<Role>();
    id: number;
  role_name: string;
  status: boolean;


  constructor( private roleService: RoleService, public dialog: MdDialog ) { }

    roles: Role[];

  ngOnInit() {
    this.onRoles()
  }
  onDelete() {
    this.roleService.deleteRole(this.role.id) 
      .subscribe( …
Run Code Online (Sandbox Code Playgroud)

angular-material2 angular

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

如何在Angular~4.3.3中添加角度材质

当我使用@angular/material和时,我收到以下错误@angular/cdk:

http://localhost:3000/@angular/cdk/observe-content (404) Not found error

systemjs.config.js

map: {
       ...

    // Angular Material 
    '@angular/material': 'npm:@angular/material/bundles/material.umd.js',

    // CDK individual packages
    '@angular/cdk/platform': 'npm:@angular/cdk/bundles/cdk-platform.umd.js',
    '@angular/cdk/a11y': 'npm:@angular/cdk/bundles/cdk-a11y.umd.js',
}
Run Code Online (Sandbox Code Playgroud)

materialmodule.ts

import { NgModule }      from '@angular/core';
import { MdButtonModule, MdCheckboxModule,MdButton } from '@angular/material';

@NgModule({
    imports: [
        MdButtonModule,
        MdButton
    ],
    exports: [
        MdButtonModule,
        MdButton
    ]
})
export class CustomMaterialModule { }
Run Code Online (Sandbox Code Playgroud)

app.component.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { …
Run Code Online (Sandbox Code Playgroud)

angular-material2 angular

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