Vue+element+Nodejs学习记录(8)原创
原创1.去掉a标签的下划线
https://jingyan.baidu.com/article/d5c4b52bfca27bda560dc5a8.html
2.Vue中data对象和函数形式
在普通的情况下Vue app中,data是一个对象:
new Vue( {
data : {
title : abc
}
} );
在Vue的Component(组件)、data要编写一个function并返回对象:
Vue.component( component-name, Vue.extend( {
data : function() {
return {
title : abc
};
}
} ) );
参考文章:
https://zhidao.baidu.com/question/492933013944472252.html
https://blog.csdn.net/baizaozao/article/details/87805634
https://www.cnblogs.com/wuqilang/p/11245915.html
3.一行或多行文本溢出内容...显示
定义此属性有四个必要条件:
1)必须具有容器宽度:width:value;
2强制文本显示在一行上:white-space:nowrap;
3)溢出内容隐藏:overflow:hidden;
4)溢出文本显示“...”:text-overflow:ellipsis;
text-overflow:clip(不显示遗漏标记)/ellipsis(当文本溢出时“...”秀场)
overflow(溢出属性):
visible(默认,未隐藏)
hidden(内容隐藏)
auto(如果内容被隐藏,则在浏览器中显示滚动条)
scroll(内容隐藏并显示滚动条)
inherit(规定应从父元素继承。overflow该物业的价值)
white-space(空格属性,用于设置如何处理元素中的空白;):
normal/pre/nowrap/pre-wrap /pre-line /inherit
normal(默认情况下,浏览器将忽略空白)
nowrap(文本不换行,文本在同一行上继续,直到遇到标签。)
为止)
pre(空白由浏览器保留,行为方式类似。HTML中的pre标签)
pre-wrap(保持空白字符的顺序,但通常换行)
pre-line(合并空白字符序列,但保留换行符)
inherit(规定应从父元素继承。White-space属性的值(ie浏览器不支持此属性值))
示例demo:
.wrapper span{
width: 220px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
4.路由跳转
这只需要跳转到页面,不需要添加验证方法,即可使用 <router-link> 要实现导航功能:
//router-link常和router-view一起使用
Hello App!
Go to Foo
Go to Bar
除了使用 <router-link> 创建a标记来定义导航链接,我们还可以使用router实例方法是通过编写代码来实现的。
想要导航到不同的 URL,则使用 router.push 方法。此方法将是 history 堆栈将添加一个新记录,因此当用户单击浏览器的后退按钮时,它将返回到上一条记录 URL。
methods:{
login(){
this.$router.push({path:/login})
},
register(){
this.$router.push({path:/register})
}
}
参考文章:
https://blog.csdn.net/qq\_33867131/article/details/81264206
https://segmentfault.com/q/1010000010041747
5.Vue中table数据导出excel
示例demo:
导出表格
导出
注意:vendor下Export2Excel.js的引入
参考文章:
https://github.com/gcddblue/vue-admin-webapp/blob/master/src/views/excel-operate/excel-out.vue
另一个实现导出Excel的示例demo:https://www.cnblogs.com/tugenhua0707/p/8597050.html
6.Vue中使用echarts和动态更新数据
参考文章:
https://panjiachen.github.io/vue-element-admin-site/zh/guide/advanced/chart.html#demo
https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/dashboard/admin/components/LineChart.vue
https://github.com/gcddblue/vue-admin-webapp/blob/master/src/views/echarts/slide-chart.vue
主要学习他们代码的规范(放在哪里)和使用。watch动态更新数据。
7.axios中get和post请求参数的传递
执行 GET 请求
// 为给定 ID 的 user 创建请求
axios.get(/user?ID=12345)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
// 上述请求也可以这样做
axios.get(/user, {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
执行 POST 请求
axios.post(/user, {
firstName: Fred,
lastName: Flintstone
})
.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) {
// 这两个请求现在都已执行
}));
参考文章:http://www.axios-js.com/zh-cn/docs/
8.
参考文章:
https://www.cnblogs.com/liufuyuan/p/10210879.html
https://www.cnblogs.com/layaling/p/9524047.html
https://www.cnblogs.com/zhangqie/p/6733808.html
https://www.baidu.com/s?tn=02003390\_43\_hao\_pg&isource=infinity&iname=baidu&itype=web&ie=utf-8&wd=node\_modules%2F\_element-ui%402.11.1%40element-ui%2Flib%2Ftheme-chalk%2Findex.css
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
itfan123




