Angular PrimeNG分割器垂直

Angular PrimeNG分割器垂直

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

分割器组件是用来做一个使用分割器分割内容的组件。

Angular PrimeNG Divider垂直属性:

  • layout。它用于指定方向。它是字符串数据类型,默认值为水平。
  • type。它是边框样式的类型。它是字符串数据类型,默认值是纯色。

语法:

<p-divider layout="vertical">
    <b>...</b>
</p-divider>

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

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

ng new appname

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

cd appname

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

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

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

Angular PrimeNG分割器垂直

运行以下命令以查看输出。

ng serve --open

实例1:这是说明使用Angular PrimeNG Divider Vertical的基本实例代码。

<h2 style="color: green">GeeksforGeeks</h2>
<h5>PrimeNG Divider Vertical</h5>
  
<div class="card">
  <div class="grid">
    <div class="p-d-flex">
      <p>
        Angular PrimeNG is a framework 
        used with angular to create components
        with great styling and this framework is 
        very easy to use and is used to
        make responsive websites.
      </p>
  
      <p-divider layout="vertical"></p-divider>
  
      <p>
        Angular PrimeNG is a framework used with 
        angular to create components with great 
        styling and this framework is very easy 
        to use and is used to make responsive websites.
      </p>
  
      <p-divider layout="vertical"></p-divider>
  
      <p>
        Angular PrimeNG is a framework used with 
        angular to create components with great 
        styling and this framework is very easy to 
        use and is used to make responsive websites.
      </p>
    </div>
  </div>
</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 { DividerModule } from 'primeng/divider';
import { ButtonModule } from 'primeng/button';
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DividerModule,
    ButtonModule,
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

输出:

Angular PrimeNG分割器垂直

示例2:下面是另一个示例代码,它说明了Angular PrimeNG Divider Vertical的使用,使用了一个虚线分隔和一些文字。

<h2 style="color: green">GeeksforGeeks</h2>
<h5>PrimeNG Divider Vertical</h5>
  
<div class="card">
  <div class="grid">
    <div class="p-d-flex">
      <p>
        Angular PrimeNG is a framework used 
        with angular to create components with great 
        styling and this framework is very easy to 
        use and is used to make responsive websites.
      </p>
  
      <p-divider type="dashed" layout="vertical">
        <b>GfG</b>
      </p-divider>
  
      <p>
        Angular PrimeNG is a framework used with 
        angular to create components with great 
        styling and this framework is very easy 
        to use and is used to make responsive websites.
      </p>
  
      <p-divider type="dashed" layout="vertical">
        <b>GfG</b>
      </p-divider>
  
      <p>
        Angular PrimeNG is a framework used with 
        angular to create components with great 
        styling and this framework is very easy 
        to use and is used to make responsive websites.
      </p>
    </div>
  </div>
</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 { DividerModule } from 'primeng/divider';
import { ButtonModule } from 'primeng/button';
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DividerModule,
    ButtonModule,
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

输出:

Angular PrimeNG分割器垂直

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程