彩票走势图

logo telerik中文文档

禁用Button


立即下载Kendo UI for Angular

默认情况下,按钮处于启用状态,若要禁用它,请将disabled属性设置为true。

查看源代码:

app.component.ts:


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

@Component({
    selector: 'my-app',
    template: `
        <div class="row">
          <div class="col-xs-12 col-sm-6 example-col">
            <p>Default Disabled Button</p>
            <p class="k-block">
              <button kendoButton (click)="onButtonClick()" themeColor="primary" [disabled]="true">Apply</button>
              <button kendoButton (click)="onButtonClick()" [disabled]="true">Cancel</button>
            </p>
          </div>

          <div class="col-xs-12 col-sm-6 example-col">
            <p>Flat Disabled Button</p>
            <p class="k-block">
              <button kendoButton (click)="onButtonClick()" fillMode="flat" themeColor="primary" [disabled]="true">Apply</button>
              <button kendoButton (click)="onButtonClick()" fillMode="flat" [disabled]="true">Cancel</button>
            </p>
          </div>

          <div class="col-xs-12 col-sm-6 example-col">
            <p>Outline Disabled Button</p>
            <p class="k-block">
              <button kendoButton (click)="onButtonClick()" fillMode="outline" themeColor="primary" [disabled]="true">Apply</button>
              <button kendoButton (click)="onButtonClick()" fillMode="outline" [disabled]="true">Cancel</button>
            </p>
          </div>

          <div class="col-xs-12 col-sm-6 example-col">
            <p>Link Disabled Button</p>
            <p class="k-block">
              <button kendoButton (click)="onButtonClick()" fillMode="link" themeColor="primary" [disabled]="true">Apply</button>
              <button kendoButton (click)="onButtonClick()" fillMode="link" [disabled]="true">Cancel</button>
            </p>
          </div>
        </div>
    `
})

export class AppComponent {
    public onButtonClick(): void {
        console.log('click');
    }
}

点击复制


app.module.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { ButtonsModule } from '@progress/kendo-angular-buttons';

import { AppComponent } from './app.component';

@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [BrowserModule, BrowserAnimationsModule, ButtonsModule],
})
export class AppModule {}

main.ts:

import "./polyfills";

import { enableProdMode } from "@angular/core";
import { AppModule } from "./app.module";
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";

enableProdMode();
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule, { preserveWhitespaces: true });
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP