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>
相关推荐
search76 小时前
前端设计:CRG 3--CDC error
前端
治金的blog6 小时前
vben-admin和vite,ant-design-vue的结合的联系
前端·vscode
利刃大大7 小时前
【Vue】Vue2 和 Vue3 的区别
前端·javascript·vue.js
荔枝一杯酸牛奶8 小时前
HTML 表单与表格布局实战:两个经典作业案例详解
前端·html
Charlie_lll8 小时前
学习Three.js–纹理贴图(Texture)
前端·three.js
yuguo.im8 小时前
我开源了一个 GrapesJS 插件
前端·javascript·开源·grapesjs
安且惜8 小时前
带弹窗的页面--以表格形式展示
前端·javascript·vue.js
GISer_Jing10 小时前
AI驱动营销:业务技术栈实战(From AIGC,待总结)
前端·人工智能·aigc·reactjs
GIS之路11 小时前
GDAL 实现影像裁剪
前端·python·arcgis·信息可视化
AGMTI11 小时前
webSock动态注册消息回调函数功能实现
开发语言·前端·javascript