ANTVUE实战学习整理一

1.

this.$refs
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button> 

<edit-form ref="editForm" :parentObj="this"></edit-form>

<script>
import EditForm from './EditForm'
 methods: {
    hanldleAdd() {
      this.$refs.editForm.openForm()
    },
</script>
小写可以用-分割开

2.标准的ANTVUE页面如下

<template>
</template> <script> import EditForm from './EditForm' const columns = [ { title: '仓库名', dataIndex: 'Warehouse', width: '10%' }, { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } } ] export default { components: { }, mounted() { }, data() { return { data: [], selectedRowKeys: [] } }, methods: { handleDelete(ids) { var thisObj = this this.$confirm({ title: '确认删除吗?', onOk() { return new Promise((resolve, reject) => { thisObj.$http.post('/BaseWarehouse/T_Warehouse/DeleteData', { ids: JSON.stringify(ids) }).then(resJson => { resolve() if (resJson.Success) { thisObj.$message.success('操作成功!') thisObj.getDataList() } else { thisObj.$message.error(resJson.Msg) } }) }) } }) } } } </script> <style> </style>

3.刷新

 <a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button>

4.axios代理:并未发现

处理流程是main.js中使用

Vue.use(AxiosPlugin)
AxiosPlugin中向外暴露
$http
$rootUrl
先根据配置获取URL然后创建实例,并未看见跨域处理,不知道是否已经不需要额外配置了,然后配置了两个拦截器,一个在请求前一个在返回后处理token的问题

 

 

 

 

 

 

 

 

 

付:

...操作符即展开语法:
1.函数调用中使用展开运算符
function test(a,b,c) { }
var args = [0,1,2];
test(...args);
相当于

function test(a, b, c) { }
var args = [0, 1, 2];
test.apply(null, args);

2.数组字面量中使用展开运算符
var arr1=['a','b','c'];
var arr2=[...arr1,'d','e']; //['a','b','c','d','e']

3.用于解构赋值
let [arg1,arg2,...arg3] = [1, 2, 3, 4];
arg1 //1
arg2 //2
arg3 //['3','4']

4.类数组对象变成数组
var list=document.getElementsByTagName('div');
var arr=[..list];

5.合并两个对象
let a={x:1,y:2};
let b={z:3};
let ab={...a,...b};
ab //{x:1,y:2,z:3}


匿名函数:
最常见的用法:
(function() {
alert('water');
})();

带参数
(function(o) {
alert(o);
})('water');

链式调用
(function(o) {
alert(o);
return arguments.callee;
})('water')('down');


JS泛型:




js中==和===区别:
简单来说: == 代表相同, ===代表严格相同, 为啥这么说呢, 

这么理解: 当进行双等号比较时候: 先检查两个操作数数据类型,如果相同, 则进行===比较, 如果不同, 则愿意为你进行一次类型转换, 转换成相同类型后再进行比较, 而===比较时, 如果类型不同,直接就是false.

 

 

posted on 2020-04-29 10:27  HOT SUMMER  阅读(697)  评论(0编辑  收藏  举报

导航