get request of axios - Code section

get method request of vue + elemetUI + axios

bug code example:

I. < script > · some codes
data() {
      return {
				resumes :[],
				xss: [],
				dialogShareFormVisible: false, // Pop up box: new share will not be displayed by default
      }
},

// ================================================================================
// Asynchronous request: get options dictionary
ajaxOptionsOfShareForm: function (e,dialogShareFormVisible,xss){
	this.dialogShareFormVisible = true;
	var key = localStorage.getItem("token");
	console.log("Get options dictionary"+key)

	var localPath = this.GLOBAL.localSrc;  // Local interface address
    var serverPath = this.GLOBAL.serverSrc; // Online interface address

	axios.get( serverPath + '/state',
		{
			params:{  // Pay attention to 1:
			
			},
			headers: { // Pay attention to 2:
				'Content-Type':'application/json',
				'Authorization': key
			}
		}
	)
	.then(function (response) {
		if (response.data.code == "200"){
			// Pop box success prompt
			this.$notify({
				title: response.data.message,
				type: 'success',
				duration: 2000
			});
		}

		localStorage.setItem("token",response.headers.authorization); // token replication local localStorage					

		console.log("Option dictionary"+response.data.data.jobIndustry);

		this.xss = response.data.data.jobIndustry
	

	}.bind(this))
	.catch(function (error) {
			console.log("request was aborted"+error);
	});

II. < templet > · some codes
<el-form-item label="Intention occupation" :label-width="labelWidth">
	<!-- <el-input v-model="form.jobIntention"  placeholder="For example: telephone sales, Internet sales, real estate sales, etc" autocomplete="off"></el-input> -->
	<el-select v-model="form.jobIntention" placeholder="For example: telephone sales, Internet sales, real estate sales, etc">
		<el-option v-for="(xs,index) in xss" :key="index" :label="xs.dictLabel" :value="xs.dictValue"></el-option>
	</el-select>
</el-form-item>

III. screenshot of postman part of API code

Related reading thinking:

Practical tests show that this method is not feasible.

Refer to the project get request page for details···

  1. searchMain.vue file
	// Condition query: asynchronous request: get options dictionary
	axios.get( serverPath + '/state',
		{
			params:{

			},
			headers: {
				'Content-Type':'application/json',
				'Authorization': key
			}
		}
	)
	.then(function (response) {
		localStorage.setItem("token",response.headers.authorization); // token replication local localStorage					

		console.log("Option dictionary"+response.data.data.jobIndustry);

		this.qzzts = response.data.data.jobWantedState // Job hunting status
		this.xls = response.data.data.jobEducation // Education

	}.bind(this))
	.catch(function (error) {
			console.log("request was aborted"+error);
	});
  1. . XML file (to be added)

That's all about "get request of axios code chapter".

Keywords: Front-end axios JSON Vue Attribute

Added by Brink Kale on Sat, 30 Nov 2019 07:44:43 +0200