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>
相关推荐
爱网安的monkey brother3 分钟前
vue3+ts项目自建训练
前端·javascript·vue.js
哆啦A梦15887 分钟前
商城后台管理系统 02,上传图片实现
前端·javascript·vue.js·elementui
破z晓9 分钟前
若依(vue版)集成ArcGIS
前端·vue.js·arcgis
计算机学姐14 分钟前
基于SSM的生鲜食品商城系统【2026最新】
java·vue.js·后端·mysql·java-ee·tomcat·mybatis
jinxinyuuuus16 分钟前
FIRE之旅 财务计算器:实时交互式建模与前端性能工程
前端·人工智能·算法·自动化
Redundantº17 分钟前
vuedraggable前端拖拽插件
前端
snow@li19 分钟前
前端:软件开发中的秤砣理论 / 越简单越可靠 / 提炼组织架构 / 精确标定工作 / 有主干有支流 / 不追求繁琐 / 不做表面工作
前端·架构
张毫洁20 分钟前
将后端resources中的文件返给前端下载的方法
前端·状态模式
Hao_Harrision23 分钟前
50天50个小项目 (React19 + Tailwindcss V4) ✨| RandomChoicePicker(标签生成)
前端·typescript·react·vite7·tailwildcss