web前端全系列 教程
1839个小节阅读:2244k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
使用UI组件库,可以提升开发效率,有一些特效是小程序组件并没有提供的,可以在组件库中寻找
全局引入,在 miniprogram 根目录下的app.json
中配置,局部引入,在需要引入的页面或组件的index.json
中配置
xxxxxxxxxx
{
"usingComponents": {
"t-rate": "tdesign-miniprogram/rate/rate"
}
}
wxml实现
xxxxxxxxxx
<view class="demo-rate">
<view class="demo-rate__title">请点击评分</view>
<!-- 实心评分,设置属性:variant-->
<t-rate value="{{ value }}" variant="filled" bind:change="onChange" />
</view>
逻辑实现
xxxxxxxxxx
Page({
data: {
value: 3
},
onChange(e) {
const { value } = e.detail;
this.setData({
value
});
},
});
全局引入,在 miniprogram 根目录下的app.json
中配置,局部引入,在需要引入的页面或组件的index.json
中配置
xxxxxxxxxx
"usingComponents": {
"t-button": "tdesign-miniprogram/button/button",
"t-sticky": "tdesign-miniprogram/sticky/sticky"
}
wxml实现
xxxxxxxxxx
<view class="top">
<t-sticky offset-top="{{0}}">
<t-button class="box2" theme="danger" t-class="inner-box" size="small">吸顶距离</t-button>
</t-sticky>
<view class="box"></view>
</view>
wxss实现
xxxxxxxxxx
.top {
margin-top: 100px;
}
.box{
height: 1000px;
}
全局引入,在 miniprogram 根目录下的app.json
中配置,局部引入,在需要引入的页面或组件的index.json
中配置
xxxxxxxxxx
"usingComponents": {
"t-toast": "tdesign-miniprogram/toast/toast"
}
逻辑实现
xxxxxxxxxx
import Toast from 'tdesign-miniprogram/toast/index';
Page({
onLoad() {
Toast({
context: this,
selector: '#t-toast',
message: '轻提示文字内容',
});
}
})
xxxxxxxxxx
<t-toast id="t-toast" />