当前位置:网站首页>Learning notes uni app
Learning notes uni app
2022-07-27 10:59:00 【weixin0605】
Environmental preparation
- install HBuilderX
- Installing a plug-in
- Built in browser
- Built-in terminal
- app Real machine operation
- prettier
- scss/sass compile
Project structures,
- div h1 The labels are web label , Unable to automatically convert non applet ,app
- Official compatibility labels must be used view text
- label
- view
- text
- navigator
- Page Jump
- url
- button
button
<button type="default" @click="goDetail"> Details page </button>
methods: {
goDetail() {
// Page Jump
uni.navigateTo({
url: '../detail/detail',
success: res => {
},
fail: () => {
},
complete: () => {
}
});
}
}
url Parameter passing
// Defining parameters
data(){
return {
name:'xx',
age:30
}
}
- navigator Parameter passing
<navigator :url="`../detail/detail?name=${name}&age=${age}`"> Details page </navigator>
- uni.navigateTo Parameter passing
uni.navigateTo({
url: `../detail/detail?name=${
this.name}&age=${
this.age}`,
});
- obtain url Parameters
data(){
return {
name:'',
age:''
}
},
onLoad(e){
console.log(e)
const {
age,name} = e;
this.age = age
this.name = name
}
pages.json
- tabBar
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/wx.png",
"selectedIconPath": "static/wx_hl.png",
"text": " home page "
},
{
"pagePath": "pages/my/my",
"iconPath": "static/my.png",
"selectedIconPath": "static/my_hl.png",
"text": " my "
}]
}
- pages.style.enablePullDownRefresh
- Allow to refresh
manifest.json
- h5
- Setting agent
"h5":{
"devServer":{
"proxy":{
"/xxx":{
"target":"https://xxx/xxx",
"changeOrgin":true;
"secure":true,
"pathRewrite":{
"^/xxx":""
}
}
}
}
}
components
- easycom Mechanism
- Components must be placed in the change folder
Life cycle
- Application life cycle
- App.vue
- onLaunch
- onShow
- onHide
- App.vue
- Page lifecycle
- onLoad
- onShow
- onHide
- onReachBottom
- Pull up and touch the bottom
- onPullDownRefresh
- Come down and refresh
- Component lifecycle
- vue relevant
- mounted
- vue relevant
Components
uni_ui
- uni-badge
- Digital angle sign
<uni-badge size="small" :text="100" absolute="rightTop" type="primary">
<button type="default"> The lower right </button>
</uni-badge>
- uni-card
- card
<uni-card title=" Basic card " :isFull="true" sub-title=" Subtitle " extra=" Additional information ">
<text> This is a bulletin card , There is no outer margin , The left and right will fit the parent element .</text>
</uni-card>
uni-dateformat
- date
uni-collapse
- uni-collapse-item
- Fold panel
uni-notice-bar
- Notice board
uni-list
- uni-list-item
- List components
uni-load-more
- Load more
- onReachBottom
- Monitoring page bottoms out
uni-rate
- score
uni-steps
- Step bar
uni-popup
- Pop-up layer
- open()
- close()
uni-grid
- GongGe
uni-swiper-dot
- swiper
- swiper-item
- Shuffling figure
- swiper
scroll-view
- Scroll bar
uni-search-bar
- Search bar
uni-index-list
- Index list
uni-goods-nav
- Commodity navigation
Network request
- uni.request
uni.request({
url:'',
method:'GET',
data:{
},
success:res=>{
// Called on success
console.log(res)
},
fail:()=>{
// Call... On failure
},
complete:()={
// Whether it succeeds or fails, it will call
}
})
Conditional compilation
- idndef
- iddef
// If not h5, Compile the url
#idndef H5
url:"https://xxx/xxx"
#endif
// If it is h5, Compile the url
#ifdef
url:'/xx/xx'
#endif
边栏推荐
- Custom page 01 of JSP custom tag
- Compete for the key battle of stock users and help enterprises build a perfect labeling system - 01 live review
- WebRTC实现简单音视频通话功能
- 发动机悬置系统冲击仿真-瞬时模态动态分析与响应谱分析
- Synaesthesia integrated de cellular super large-scale MIMO and high-frequency wireless access technology
- ECCV 2022 | 同时完成四项跟踪任务!Unicorn: 迈向目标跟踪的大统一
- 文档智能多模态预训练模型LayoutLMv3:兼具通用性与优越性
- 颜值爆表!推荐两款JSON可视化工具,配合Swagger使用真香
- MIMO array 3D imaging technology based on mobile terminal
- MySQL log management, backup and recovery
猜你喜欢

PyQt5快速开发与实战 4.2 QWidget

Customized modification based on jira7.9.2

MySQL index, transaction and storage engine

推导STO双中心动能积分的详细展开式

文档智能多模态预训练模型LayoutLMv3:兼具通用性与优越性

Your appearance is amazing! Two JSON visualization tools are recommended for use with swagger. It's really fragrant

深度解析:什么是Diffusion Model?

迭代次数的差异与信息熵

厉害了!VMware ESXi安装记录,附下载

How to modify the strict mode under MySQL so that adding new users by inserting user table is successful
随机推荐
How to create a.Net image with diagnostic tools
搭建 Samba 服务
Review and Prospect of encrypted traffic identification based on deep learning
Tdengine business ecosystem partner recruitment starts
图片中非0值的数量对分类的影响
推导STO双中心动能积分的详细展开式
Record of a cross domain problem
Advanced operation of MySQL data table
The largest square of leetcode (violence solving and dynamic programming solving)
Time and power allocation method to ensure fairness in sensor fusion system
Set up Samba service
TensorFlow笔记——基本函数及概念
发动机悬置系统冲击仿真-瞬时模态动态分析与响应谱分析
MySQL log management, backup and recovery
推导重叠积分的详细展开式 STO overlap integrals
TDengine 助力西门子轻量级数字化解决方案 SIMICAS 简化数据处理流程
Iptables prevent nmap scanning and binlog explanation
IO流_数据输入输出流的概述和讲解
正则form表单判断
The core concept and fast practice of shardingsphere