This section describes how to separate vue-admin from backend (flask ).
This article introduces an example of how to separate vue-admin from backend (flask ).
I think the vue-admin interface is very good. I wrote a small Demo.
I can see that issues has many questions about backend data requests.
Upload the latest vue-admin-flask-example and share it with you.
API summary:
Login
Var params = {username: this. ruleForm2.account, password: this. ruleForm2.checkPass}; export const requestLogin = params => {return axios ({method: 'post', url: '$ {base}/login', auth: params }). then (res => res. data) ;}; return jsonify ({'code': 200, 'msg ': "Logon successful", 'Token': token. decode ('ascii '), 'name': g. admin. name })
Change Password
Let params = Object. assign ({}, this. setpwdForm); export const setpwd = params => {return axios. post ('$ {base}/setpwd', params) ;}; return jsonify ({'code': 200, 'msg': "password modified successfully "})
User acquisition
let params = { page: this.page, name: this.filters.name };export const getUserListPage = params => { return axios.get(`${base}/users/listpage`, { params: params });};return jsonify({ 'code': 200, 'total': total, 'page_size': page_size, 'infos': [u.to_dict() for u in Infos] })
Delete a user
Let params = {id: row. id}; export const removeUser = params => {return axios. get ('$ {base}/user/delete', {params: params}) ;}; return jsonify ({'code': 200, 'msg ': "deleted successfully "})
Batch Delete
Let para = {ids: ids}; export const batchRemoveUser = params => {return axios. get ('$ {base}/user/bathremove', {params: params}) ;}; return jsonify ({'code': 200, 'msg ': "deleted successfully "})
Obtain bar chart data
export const getdrawPieChart = () => { return axios.get(`${base}/getdrawPieChart`);};return jsonify({'code': 200, 'profess_value': profess_value, 'grade_value': grade_value, 'grade_data': grade_data})
Obtain pie chart data
export const getdrawLineChart = () => { return axios.get(`${base}/getdrawLineChart`);};return jsonify({'code': 200, 'value': data_value, 'total': total})
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.