提交json数据
this.$http.post("/api/getsenbyuserid",this.req){
headers: {
'Content-Type':'application/json;charset=UTF-8'
}
}).then(response => {
// 成功响应回调
this.info = response.data
})
.catch(error => {
// 失败响应回调
console.log(error)
this.errored = true
})
.finally(() => this.loading = false)// 无论成功还是失败都会回调,常用于改变loading状态
从route取值
this.$route.params.classifyid
从store取值
取字符串
this.$store.state.token
取json 需要转换下
(JSON.parse(this.$store.state.user)).userId;
vue文件模板
<template>
<div class="logreg">
<h1>This is an about page</h1>
</div>
</template>
<script>
export default {
name: 'logreg',
components: {
},
props: {
va: String,
ty: Number
},
data(){
return {
loading:false
}
},
watch:{
},
created(){
},
methods:{
},
mounted(){
}
}
</script>
<style scoped lang="less">
</style>
element Loading动画
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// 关闭loading动画
loading.close();
CSS控制文字,超出部分显示省略号
单行
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
多行
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;