当前位置:网站首页>Uni app Foundation
Uni app Foundation
2022-06-13 02:40:00 【And white】
Directory structure

New interface

// After the new page is created, if you are in page.json There is no corresponding interface declaration in Please be there. pages Inside plus
{
"path": "pages/index/index",// The path of the page
"style": {
"navigationBarTitleText": " children APP", // Top title
"enablePullDownRefresh": false,// Enable pull-down refresh
"app-plus": {
"titleNView": false // Do not use the system top navigation bar
}
}
},
uniApp All in the interface div Have been replaced by view

uniapp Page supported lifecycles
The screenshot here is only part of You can check it here
https://uniapp.dcloud.io/collocation/frame/lifecycle?id=page

created stay vue Can be supported in But in uniapp I only support onload
Interface jump
// Similar to an applet
uni.navigateTo({
url: '/pages/index/index',
success: res => {
},
fail: () => {
},
complete: () => {
}
});
//vue
this.$router.push('/pages/index/index')
//router Jump
this.$route({
url: 'pages/index/index'
})
Interface value transfer ( Just like a small program )
uni.navigateTo({
// It can also be in url Intermediate direct value transfer
url:'/pages/niceServeDetail/niceServeDetail?id=666',
// Receive the value from the second interface
events: {
// Add a listener... For the specified event , Get the data transferred from the opened page to the current page
acceptDataFromOpenedPage: function(data) {
console.log(data)
},
someEvent: function(data) {
console.log(data)
}
},
success: (res) => {
// Transfer values to the second interface
res.eventChannel.emit("title","titleContent")
// The second interface transfers values to the first interface
eventChannel.emit('acceptDataFromOpenedPage', {
data: 'data from second page'});
eventChannel.emit('someEvent', {
data: 'data from second page for someEvent'});
}
})
// In the second interface onload In the receiving
onload(option){
console.log(" Here is url Transmitted value ->",option.id);
// #ifdef APP-NVUE
const eventChannel = this.$scope.eventChannel; // compatible APP-NVUE
// #endif
// #ifndef APP-NVUE
const eventChannel = this.getOpenerEventChannel();
// #endif
eventChannel.on("title",(res)=>{
console.log(" The value received ->",res);
})
}
Play the news ( It is surprisingly similar to an applet )
uni.showToast({
title: 'msg',
icon:'none',
mask:false,// Similar to transparent mask effect , Click to penetrate
});
Using third party dependencies
Follow vue It's the same
// For example, add dependencies uni-ui
npm i uni-ui -S
Network request
uni.request({
url:"url",
data:" Request parameters ",
method:"GET",
success: (e) => {
//TODO
},
fail: (e) => {
}
})
Pull up to refresh Pull down load
// Pull down data refresh Need to open "enablePullDownRefresh": true,
// Drop down listening function
onPullDownRefresh() {
},
// Bottom function That is, pull up the monitor stay vue Life cycle function peers in the interface
onReachBottom() {
}
Bottom navigation bar settings

vuex Use vuex Official website
stay uniApp Built in vuex We just need to configure it
// stay index In file
// Page path :store/index.js
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);//vue Plug in mechanism of
//Vuex.Store Constructor options
const store = new Vuex.Store({
state:{
// Storage status
"username":"foo",
"age":18
}
})
export default store
### stay main.js Inject... Into the file
// Page path :main.js
import Vue from 'vue'
import App from './App'
import store from './store'
Vue.prototype.$store = store // Setting global $store object
// hold store The object is provided to “store” Options , This can store All the subcomponents are injected with the instance of
const app = new Vue({
store,
...App
})
app.$mount()
Use
this.$store.state.username // Can get
vuex Zhongduo module Under the circumstances state obtain
//this.$store.state. The name of the warehouse .prop
this.$store.state.mineStore.isLogin
边栏推荐
- [Dest0g3 520迎新赛] 拿到WP还整了很久的Dest0g3_heap
- Redis multiple servers share one
- Leetcode 450. 删除二叉搜索树中的节点 [二叉搜索树]
- Detailed installation tutorial of MATLAB r2019 B-mode ultrasound (complete installation files are attached)
- Think about the possibility of attacking secure memory through mmu/tlb/cache
- 智能安全配电装置如何减少电气火灾事故的发生?
- [reading papers] comparison of deeplobv1-v3 series, brief review
- regular expression
- Pycharm installation pyqt5 and its tools (QT designer, pyuic, pyrcc) detailed tutorial
- FFmpeg原理
猜你喜欢
![[reading some papers] introducing deep learning into the public horizon alexnet](/img/4b/6d9bafe48094ff6451efb211d83371.jpg)
[reading some papers] introducing deep learning into the public horizon alexnet
![[data analysis and visualization] key points of data drawing 8- use of circular bar chart](/img/1f/232f2f0134867eeec3f1cfe005b2b5.jpg)
[data analysis and visualization] key points of data drawing 8- use of circular bar chart

Queuing theory, game theory, analytic hierarchy process

Stm32f4 DMA Da sine wave generator keil5 Hal library cubemx

Detailed installation tutorial of MATLAB r2019 B-mode ultrasound (complete installation files are attached)

05 tabBar导航栏功能

Why does it feel that most papers still use RESNET as the backbone network rather than densenet?

Impossible d'afficher le contenu de la base de données après que l'idée a utilisé le pool de connexion c3p0 pour se connecter à la base de données SQL
![[data analysis and visualization] key points of data drawing 5- the problem of error line](/img/d7/a54129d2c7bdf7caf764f6f8db9fc1.jpg)
[data analysis and visualization] key points of data drawing 5- the problem of error line

数仓笔记|针对客户维度建模需要关注的5个因素
随机推荐
[data and Analysis Visualization] data operation in D3 tutorial 3-d3
Queuing theory, game theory, analytic hierarchy process
Opencv 9 resize size change rotate rotate blur mean (blur)
L1 regularization and its sparsity
CV 06 demonstrates backgroundworker
[reading papers] comparison of deeplobv1-v3 series, brief review
Flow chart of interrupt process
Matlab: find the inner angle of n-sided concave polygon
too old resource version,Code:410
[Dest0g3 520迎新赛] 拿到WP还整了很久的Dest0g3_heap
[reading some papers] introducing deep learning into the public horizon alexnet
[common tools] pyautogui tutorial
Armv8-m (Cortex-M) TrustZone summary and introduction
redis. Conf general configuration details
redis.conf总配置详解
Stm32f4 DMA Da sine wave generator keil5 Hal library cubemx
Data processing in detailed machine learning (II) -- Feature Normalization
Graph theory, tree based concept
Leetcode 926. Flip string to monotonically increasing [prefix and]
Priority queue with dynamically changing priority