当前位置:网站首页>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
边栏推荐
- YonBuilder赋能创新,用友第四届开发者大赛“金键盘奖”开启竞逐!
- 颜值爆表!推荐两款JSON可视化工具,配合Swagger使用真香
- The permission problem of Oracle operating openldap
- Set up Samba service
- Free DIY trip
- Analysis of C language pointer function and function pointer
- 学习笔记-minio
- Analysis of new communication security risks brought by quantum computer and Countermeasures
- 荒野觅踪---寻找迭代次数
- No Identifier specified for entity的解决办法
猜你喜欢

Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)

Chunjun supports DDL conversion and automatic execution of heterogeneous data sources - dtmo 02 review (including course playback + courseware)

parsel的使用

迭代次数和熵之间关系的一个验证试验

Open source project - taier1.2 release, new workflow, tenant binding simplification and other functions

Delete in MySQL: the difference between delete, drop and truncate

全校软硬件基础设施一站式监控 ,苏州大学以时序数据库替换 PostgreSQL

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

antd table+checkbox 默认值显示

熵与形态的非递进现象
随机推荐
JVM -- Analysis of bytecode
Tdengine business ecosystem partner recruitment starts
c语言指针函数和函数指针的辨析
Application scenarios, key technologies and network architecture of communication perception integration
Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)
Record of a cross domain problem
Substr and substring function usage in SQL
如何创建一个带诊断工具的.NET镜像
泰山OFFICE技术讲座:缩放比例与打开文件
Detailed explanation of status code meaning
ASP. Net core dependency injection journey: 1. Theoretical concepts
A measurement method of 5g air interface one-way delay and its reliability
Views, triggers and stored procedures in MySQL
DNS principle and resolution process
Customized modification based on jira7.9.2
ECCV 2022 | 同时完成四项跟踪任务!Unicorn: 迈向目标跟踪的大统一
分布式块设备复制:客户端
熵与形态的非递进现象
BeautifulSoup的使用
Use__ slots__ And__ dict__ To save space (it's simply a qualitative leap, and leetcode's personal test is effective)