不同button的设置

基础按钮用法

按钮分为:默认按钮、朴素按钮(plain)、圆角按钮(round)、圆形按钮(circle)。
  通过 type 属性指定 primary、success、info、warning、danger、text 其中的值设置按钮样式,其中若设置值为 text ,则为文字按钮,没有边框和背景颜色

默认按钮

  <el-row>
   <el-button>默认按钮</el-button>
    <el-button type="primary">主要按钮</el-button>
   <el-button type="success">成功按钮</el-button>
   <el-button type="info">信息按钮</el-button>
   <el-button type="warning">警告按钮</el-button>
   <el-button type="danger">危险按钮</el-button>
 </el-row>

朴素按钮

 <el-row>
   <el-button plain>朴素按钮</el-button>
   <el-button type="primary" plain>主要按钮</el-button>
   <el-button type="success" plain>成功按钮</el-button>
   <el-button type="info" plain>信息按钮</el-button>
   <el-button type="warning" plain>警告按钮</el-button>
   <el-button type="danger" plain>危险按钮</el-button>
</el-row>

圆角按钮

 <el-row>
   <el-button round>圆角按钮</el-button>
   <el-button type="primary" round>主要按钮</el-button>
   <el-button type="success" round>成功按钮</el-button>
   <el-button type="info" round>信息按钮</el-button>
   <el-button type="warning" round>警告按钮</el-button>
   <el-button type="danger" round>危险按钮</el-button>
 </el-row>

图片

 <el-row>
   <el-button icon="el-icon-search" circle></el-button>
   <el-button type="primary" icon="el-icon-edit" circle></el-button>
   <el-button type="success" icon="el-icon-check" circle></el-button>
   <el-button type="info" icon="el-icon-message" circle></el-button>
   <el-button type="warning" icon="el-icon-star-off" circle></el-button>
   <el-button type="danger" icon="el-icon-delete" circle></el-button>
 </el-row>

按钮样式

在这里插入图片描述

### 不同编程环境中为 Push Button 设置文本的方法 #### HTML 和 JavaScript 环境 在网页开发中,如果要修改带有 `lightButton` 类的按钮上的文字内容,可以使用如下代码片段来实现: ```javascript document.querySelectorAll('.lightButton').forEach(button => { button.textContent = '新的按钮文案'; }); ``` 这段脚本会遍历页面中所有的 `.lightButton` 按钮并将其显示的文字更改为指定的新文案[^1]。 #### Python Tkinter 库 对于桌面应用程序开发者来说,在Python环境下利用Tkinter库创建GUI界面时,可以通过下面的方式更新按钮标签: ```python import tkinter as tk root = tk.Tk() button = tk.Button(root, text="原始文本") button.pack() def change_text(): button.config(text='新文本') change_button = tk.Button(root, text="更改", command=change_text) change_button.pack() root.mainloop() ``` 此段代码展示了如何定义一个函数用于改变已存在的按钮上的文本,并通过另一个按钮触发该变更事件. #### Qt (C++ 或者 PyQt/PySide) 当采用Qt框架构建跨平台的应用程序时,无论是原生 C++ 还是在 Python 中借助于 PyQT 或 Pyside 绑定包,都可以这样设置QPushButton对象的text属性: ```cpp // 对应于C++ QPushButon *button = new QPushButton(); button->setText(tr("New Text")); ``` 或者如果是基于Python的话,则是这样的写法: ```python from PyQt5.QtWidgets import QApplication, QPushButton app = QApplication([]) button = QPushButton('旧文本') button.setText('新文本') # 更改按钮上的文本 button.show() app.exec_() ``` 上述例子说明了怎样直接调用 setText 方法给按钮赋值新字符串作为其展示的内容.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值