type 属性的用途和实现方式(图标,表单,数据可视化,自定义组件)

1.图标类型

<uni-icon>组件中,type可以用来指定图标的不同样式。

复制代码
<uni-icons type="circle" size="30" color="#007aff"></uni-icons>     //表示圆形
<uni-icons type="square" size="30" color="#007aff"></uni-icons>    //表示方形
<uni-icons type="triangle" size="30" color="#007aff"></uni-icons>    //表示三角形
<uni-icons class="input-uni-icon" type="search" size="1" color="#999" />    //表示搜索图形

2.表单控件类型

在表单元素中,type属性用于指定输入控件的类型。

复制代码
<input type="text" placeholder="文本输入框">
<input type="password" placeholder="密码输入框">
<input type="checkbox"> 复选框
<input type="radio"> 单选框
<input type="file"> 文件选择

3.数据可视化图标类型

在数据可视化库中,type属性用于指定图表的类型

复制代码
// 使用 Plotly 创建柱状图
Plotly.newPlot('myDiv', [{
  x: [1, 2, 3, 4],
  y: [10, 15, 13, 17],
  type: 'bar'  // 柱状图
}]);

// 使用 Plotly 创建饼图
Plotly.newPlot('myDiv', [{
  labels: ['A', 'B', 'C'],
  values: [10, 20, 30],
  type: 'pie'  // 饼图
}]);

4.自定义组件中的类型

复制代码
<my-component type="primary">主要按钮</my-component>
<my-component type="secondary">次要按钮</my-component>
<my-component type="danger">危险按钮</my-component>
相关推荐
KaMeidebaby3 小时前
卡梅德生物技术快报|兔单克隆抗体应用实战:禽源病原 IFA 检测全流程拆解
前端·人工智能·物联网·算法·百度
lulu12165440783 小时前
OpenAI 如何用开源前端生态为 GPT-5.6 铺路? - 微元算力(weytoken)
java·前端·人工智能·python·gpt·开源·ai编程
问心无愧051311 小时前
ctf show web入门160 161
前端·笔记
李小白6611 小时前
第四天-WEB服务器基本原理,IIS服务
运维·服务器·前端
humcomm12 小时前
AI编程时代新前端职位
前端·ai编程
好家伙VCC12 小时前
Web Components主题热切换方案揭秘
java·前端
甲维斯13 小时前
Kimi版超级玛丽效果“惊人”,配额不足5厘米!
前端·人工智能
hboot13 小时前
AI工程师第一课 - Python
前端·后端·python
凉菜凉凉13 小时前
AI时代,被抛弃的前端
前端·ai
console.log('npc')13 小时前
AI前端工程与生成式UI学习路线
前端·人工智能·ui