日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

android创建构建方法,Android 应用程序构建实战+原理精讲

發布時間:2025/3/12 Android 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android创建构建方法,Android 应用程序构建实战+原理精讲 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

轉載來自51cto:https://blog.51cto.com/15091291/2629464

new Vue({

el: '#app',

data () {

return {

info: null

}

},

mounted () {

axios

.get('https://www.runoob.com/try/ajax/json_demo.json')

.then(response => (this.info = response))

.catch(function (error) { // 請求失敗處理

console.log(error);

});

}

})

嘗試一下 ?

使用 response.data 讀取 JSON 數據:

GET 實例

網站列表

v-for="site in info"

{{ site.name }}

new Vue({

el: '#app',

data () {

return {

info: null

}

},

mounted () {

axios

.get('https://www.runoob.com/try/ajax/json_demo.json')

.then(response => (this.info = response.data.sites))

.catch(function (error) { // 請求失敗處理

console.log(error);

});

}

})

嘗試一下 ?

GET 方法傳遞參數格式如下:

傳遞參數說明

// 直接在 URL 上添加參數 ID=12345

axios.get('/user?ID=12345')

.then(function (response) {

console.log(response);

})

.catch(function (error) {

console.log(error);

});

// 也可以通過 params 設置參數:

axios.get('/user', {

params: {

ID: 12345

}

})

.then(function (response) {

console.log(response);

})

.catch(function (error) {

console.log(error);

});

POST 方法

POST 實例

new Vue({

el: '#app',

data () {

return {

info: null

}

},

mounted () {

axios

.post('https://www.runoob.com/try/ajax/demo_axios_post.php')

.then(response => (this.info = response))

.catch(function (error) { // 請求失敗處理

console.log(error);

});

}

})

嘗試一下 ?

POST 方法傳遞參數格式如下:

傳遞參數說明

axios.post('/user', {

firstName: 'Fred', // 參數 firstName

lastName: 'Flintstone' // 參數 lastName

})

.then(function (response) {

console.log(response);

})

.catch(function (error) {

console.log(error);

});

執行多個并發請求

實例

function getUserAccount() {

return axios.get('/user/12345');

}

function getUserPermissions() {

return axios.get('/user/12345/permissions');

}

axios.all([getUserAccount(), getUserPermissions()])

.then(axios.spread(function (acct, perms) {

// 兩個請求現在都執行完成

}));

axios API

可以通過向 axios 傳遞相關配置來創建請求。

實例

axios(config)

// 發送 POST 請求

axios({

method: 'post',

url: '/user/12345',

data: {

firstName: 'Fred',

lastName: 'Flintstone'

}

});

// GET 請求遠程圖片

axios({

method:'get',

url:'http://bit.ly/2mTM3nY',

responseType:'stream'

})

.then(function(response) {

response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))

});

axios(url[, config])

// 發送 GET 請求(默認的方法)

axios('/user/12345');

請求方法的別名

為方便使用,官方為所有支持的請求方法提供了別名,可以直接使用別名來發起請求:

axios.request(config)

axios.get(url[, config])

axios.delete(url[, config])

axios.head(url[, config])

axios.post(url[, data[, config]])

axios.put(url[, data[, config]])

axios.patch(url[, data[, config]])

總結

以上是生活随笔為你收集整理的android创建构建方法,Android 应用程序构建实战+原理精讲的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。