Angular PrimeNG Skeleton尺寸

Angular PrimeNG Skeleton尺寸

Angular PrimeNG是一个开源框架,拥有丰富的原生Angular UI组件,可用于出色的造型,该框架可用于制作响应式网站,非常方便。在这篇文章中,我们将了解如何在Angular PrimeNG中使用Skeleton大小。我们还将了解代码中将要使用的属性及其语法。

Skeleton组件可以作为要显示的材料的替身。使用矩形的宽度和高度属性以及圆形和正方形的尺寸属性来改变尺寸。

Angular PrimeNG Skeleton尺寸属性:

  • shape。它用于定义元素的形状。shape的可接受值是”矩形”和”圆形”。默认值是矩形。
  • size。它用于定义元素的大小。默认值是null 。
  • width: 用来定义元素的宽度。宽度的默认值是100%。
  • height: 它用于定义元素的高度。宽度的默认值是1rem._。
  • styleClass。它用于定义元素的风格类别。宽度的默认值是null。

创建Angular应用程序和模块安装。

第1步:使用以下命令创建一个Angular应用程序。

ng new appname

第2步:创建你的项目文件夹即appname后,使用以下命令移动到它。

cd appname

第3步在你给定的目录中安装PrimeNG。

npm install primeng --save
npm install primeicons --save

项目结构:它将看起来像如下。

Angular PrimeNG Skeleton尺寸

  • 运行下面的命令可以看到输出。
ng serve --open

示例1:下面的示例代码说明了使用_Rectangle_Skeleton的Angular PrimeNG Skeleton Size的用法。

<h2 style="color: green">GeeksforGeeks</h2>
<h5>Angular PrimeNG Skeleton Size</h5>
  
<p-skeleton
      shape="rectangle"
      width="20rem" 
      height="5rem"
      styleClass="p-mb-2">
</p-skeleton>
  
<p-skeleton
      shape="rectangle"
      width="15rem" 
      height="3rem"
      styleClass="p-mb-2">
</p-skeleton>
  
<p-skeleton 
      shape="rectangle"
      width="10rem" 
      height="2rem"
      styleClass="p-mb-2">
</p-skeleton>
import { Component } from "@angular/core";
  
@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.scss"],
})
export class AppComponent {}
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule }
    from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { SkeletonModule } from "primeng/skeleton";
  
@NgModule({
  imports: [BrowserModule, 
              BrowserAnimationsModule, 
              SkeletonModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

输出:

Angular PrimeNG Skeleton尺寸

示例2:下面是另一个示例代码,说明了Angular PrimeNG Skeleton尺寸使用Circular Skeleton。

<h2 style="color: green">GeeksforGeeks</h2>
  <h5>Angular PrimeNG Skeleton Size</h5>
  
<div class="p-d-flex">
    <p-skeleton
          shape="circle"
          size="8rem"
          styleClass="p-mb-2">
    </p-skeleton>
    <p-skeleton
          shape="circle"
          size="5rem"
          styleClass="p-mb-2">
    </p-skeleton>
    <p-skeleton 
          shape="circle"
          size="3rem"
          styleClass="p-mb-2">
    </p-skeleton>
</div>
import { Component } from "@angular/core";
  
@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.scss"],
})
export class AppComponent {}
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule }
    from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { SkeletonModule } from "primeng/skeleton";
  
@NgModule({
  imports: [BrowserModule, 
              BrowserAnimationsModule, 
              SkeletonModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

输出:

Angular PrimeNG Skeleton尺寸

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程