前端开发、easyUI+vue+uView开发问题记录

Easy-UI语法

1.table-时间列格式转换

formatter:function (value,row,index) {
      var oldTime = (new Date(value)).getTime();
      return new Date(oldTime).format("yyyy-MM-dd");
  }

2.按钮图片样式存储

static\plugins\font-awesome-4.7.0\css\font-awesome.css

3.防止table加载两次

1.table定义不加url
2.加载时:
    grid.datagrid('options').url = "/repairExtraCost/list";
    grid.datagrid('load', { planId: data.id});

4.dialog弹出框无法垂直居中

$('#toRepairDlg').window('hcenter');

5.输入条件查询easyUI表格,出现N行空表格数据

//系上一次查询的5条数据,这次查询为空,并且返回格式不符合DataGrid格式,查看page返回的格式
//如果未空,可以这么返回
    return RespTable.ok(RespTable.getPage(InstanceVO.class, request));

6.树形结构 treegrid弹出框保存后,不刷新问题

//重点在此 openner_template_datagrid
$.modalDialog.openner_template_datagrid = materialTypeTabGrid;
​
edit.html中save方法:
$.modalDialog.openner_template_datagrid.treegrid("reload");

7.可编辑combogrid字段选择后,空白处弹出数据表格

//先结束编辑,再更新行
supplierPriceGrid.datagrid('endEdit', editIndex);
supplierPriceGrid.datagrid('updateRow', {index:x,row:{...}});

8.date-box不可选当前时间之后的日期

    $('#applyDate').datebox().datebox('calendar').calendar({
        validator : function(date){
            var now = new Date();
            var d1 = new Date(now.getFullYear(),now.getMonth(),now.getDate());
            return d1 >= date;
        }
    });

9.输入后远程自动刷新查询数据remote

js: mode: 'remote',
java: @RequestParam(name = "q", defaultValue = "") String keyword
备注:如果是combotree等部分组件,不需要访问后台就可以自动过滤

10.点击复选框行中某一列,会自动取消/勾选复选框(比如只想要查看图片)

//定义变量lookImg;
var lookImg = true;
//datagrid定义勾选、取消勾选的方法
onBeforeCheck: function (index, row) {
                if (lookImg) {
                    return lookImg;
                }
                lookImg = true;
​
                return false;
            },
            onBeforeUncheck: function (index, row) {
                if (lookImg) {
                    return lookImg;
                }
                lookImg = true;
​
                return false;
            }
//特定单元格的点击时间中, 做lookImg变量处理
function xxxx(){
    lookImg = false;
    ...
    ...
}
​

10. treegrid多选框,仅选择一部分数据,没上传父节点问题

var inNodes = componentsTempGrid.treegrid('getCheckedNodes', 'indeterminate');
var chkNodes = componentsTempGrid.treegrid('getCheckedNodes', 'checked');
var rows = inNodes.concat(chkNodes);

uView开发

1.富文本框输入


​
return{textarea:'textarea'}

2.页面下拉刷新

onPullDownRefresh(){
}

3.swiper轮播图图片展示不全问题

增加属性:
:img-mode="aspectFit"
​
声明变量:aspectFit:‘aspectFit’

4.vue时间不能超过当前时间

if(Date.parse(problemObj.problemTime) > new Date()){
    this.$u.toast("故障时间不能超过当前时间!")
    return
}

你可能感兴趣的:(easyui,vue.js,前端,uView)