current position:Home>Harmonyos+django data transmission ------------- note 1
Harmonyos+django data transmission ------------- note 1
2022-07-25 20:26:29【Maruko_ four hundred and twenty-eight】
1. The front-end configuration
1.config.json
1.deviceConfig
"default": {
"process": "com.huawei.hiworld.example",
"supportBackup": false,
"network": {
"cleartextTraffic": true
}
}
2. module
"reqPermissions": [
{
"name": "ohos.permission.GET_NETWORK_INFO"
},
{
"name": "ohos.permission.SET_NETWORK_INFO"
},
{
"name": "ohos.permission.INTERNET"
}
],
2. page
1.hml
<div class="container">
<text class="txt"> Click button </text>
<button class="button01" onclick="onClick">
Request and response
</button>
<text>{
{winfo}}</text>
</div>
2.js
Need to install :qs library 、fetch
npm install qs
npm install querystring
js Content
import fetch from '@system.fetch';
import qs from 'querystring';
export default{
data:{
winfo:"",
},
onClick(){
fetch.fetch({
// Back end interface ,AppReq1 by views Class name in
url:'http://“ Own request port ”/“ establish app The name of ”/AppReq1/' ,
data:qs.stringify({'id':'1'}),
responseType:"json",
method:"POST",
success:(resp)=>{
this.winfo = resp.data;
console.log(" Return the data :"+this.winfo)
},
fail:(resp)=>{
this.winfo = resp.data;
console.log(" Failed to get data :"+this.winfo)
}
})
}
}
copyright notice
author[Maruko_ four hundred and twenty-eight],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/201/202207191111371127.html
The sidebar is recommended
- Pythonnote032 --- Python print colored string
- Pythonnote031 --- interaction between Python and HDFS
- Meanshift clustering -02python case
- For else usage in Python
- Combined usage of for loop and return statement in Python language
- Take one frame every three frames from the video file in Python and save it
- Python+opencv+dlib to achieve target tracking
- Edge extraction in python+opencv image processing
- python:ModuleNotFoundError: No module named ‘tensorflow.compat.v1‘
- Perfect combination of Python and Excel: summary of common operations (detailed analysis of cases)
guess what you like
Deduce the magical game of life with Python, and learn numpy and Matplotlib animation in the game
Python_ Waiting operation of selenium
If you want to package Python scripts into exe executable files with pyinstaller, there are always errors. How to package with.Pyinstaller?
30 Python operation tips
Python obtains the hardware information of MacBook Pro device and sends it to group chat through webhook
Python from getting started to giving up
Opencv - Python face recognition demo
Easily realize Python dynamic configuration management - dynaconf
Python compression and offsite backup scripts
Pypy interpreter of Python interpreter
Random recommended
- Can you add a syntax sugar to Cpython to check the type?
- Docx document reading of Python learning notes
- Format conversion between doc and docx in Python learning notes
- Openpyxl module of Python learning notes reading and writing Excel spreadsheet
- Python turtle library drawing
- Python basic grammar (mind map)
- Pandas numeric sort_ How to use values()
- How Python uses pymysql to encapsulate the general connection and query of projects
- Explain in detail the scope of closures and lambda in Python
- Pandas index sort df.sort_ Implementation method of index()
- Python takes you to analyze online used car data
- How to convert raw data into sentences in Python?
- Django deployment and launch
- Django- develop get and post interfaces and basic operations
- Python interview encyclopedia Python Foundation
- [python] character coding based on chardet recognition
- How to use numpy in pandas foundation?
- How to calculate the difference between the maximum value and the minimum value in pandas foundation?
- How to use functions in every line in pandas foundation?
- How to use the axis parameter in pandas foundation?
- Python handles excel tables under secondary folders
- 100 days proficient in python (data analysis) - day 48: introduction to data analysis
- 30 Python operation tips
- Prettytable: a python library that can perfectly format output like a database
- Python batch starts webdriveragent of IOS devices
- Teach you to quickly learn python programming language through 14 introductory practical cases
- This is the most powerful Python question brushing website
- Encyclopedia of common basic grammar knowledge of Python
- Cache: better function operation cache in Python
- One click replacement of ID photo background, python makes visual GUI interface, which is really delicious
- 9 single line Python codes that should be known and learned
- Mock series of Python test framework unittest (III) - reset method, create_ Autospec, decorator / manager, dependency testing
- Python%s%d (usage of words in ancient Chinese)
- How can we use Python to implement the binary search algorithm we often use in guessing number games?
- Python computing thinking training -- dictionary and string practice (2)
- Python computing thinking training -- array and curve drawing exercise (I)
- Python automated test interview questions (II) (continuously updated)
- Python practical tips
- Automatic directory monitoring in Python
- Horn clause resolution based on Python implementation