Code Monkey home page Code Monkey logo

ccms-components's People

Contributors

arzyu avatar ashnorseman avatar cqq151314 avatar dale- avatar discipled avatar gaochaodd avatar greria avatar happyzijunluo avatar hjzheng avatar huerhai avatar jiaoxie avatar kuitos avatar liyuan-meng avatar michaelycy avatar peachlemon avatar qixman avatar rookie125 avatar silence717 avatar steamedbread2333 avatar wweli avatar yangbiaolong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ccms-components's Issues

too low

angular.js用es6写,代码真是恶心到爆
排版格式太low,差评

tooltip自定义模板结合ng-repeat使用问题

使用cc-tooltip和grid举例说明遇到的问题:

    1. 多次进入获取模板方法
    1. 每次hover触发指令两次
    1. 指令传递对象,compile不通过,报类型转换错误
    1. 传递回调方法,假设为刷新grid表格,一直不断给后端发送请求,进入死循环浏览器卡死

基于grid表格demo作为基础,只列举个人添加主要代码。重现步骤:

在grid的cellTemplate中配置cc-tooltip,代码如下:

{
	cellTemplate: '<span ng-bind="entity.name" tooltip-compilable="true" cc-tooltip="app.getTemplateUrl(entity)" tooltip-append-to-body="true"></span>',
	displayName: '姓名',
	align: 'center',
	width: '100px',
	sortProp: 'name'
}

在controller里面添加getTemplateUrl方法,里面描述了我遇到的4个问题:

this.getTemplateUrl = function(entity) {
	// case1: 每次ng-repeat进入编译没错,所以log出来的1的次数应该和数据长度匹配,但是事实不是这样。。。
	console.log(1);
	// case2: tooltip hover上去,应该触发一次指令编译,但是只要hover,就会触发两次
	console.log(entity);
	// case3: 传递对象错误一直是类型转换错误
	// return '<demo obj="'+entity+'"></demo>';
	// case4: 传递回调方法,一直不断给后端发送请求,进入死循环
	// return '<demo callback="'+this.refreshGrid()+'"></demo>';
	// 正常情况: 字符串可正常传递
	return '<demo test="test"></demo>';
};

编写简单的demo指令:

angular
	.module('componentsApp')
	.directive('demo', function(){
		return {
			restrict: 'E',
			scope: {
				callback: '&',
				obj: '=',
				test: '@'
			},
			template: '<div ng-bind="vm.obj.name"></div>',
			controller: function() {
				this.callback();
				console.log('**********');	
				console.log(this.obj);
				console.log(this.test);
				console.log('============');	
			},
			controllerAs: 'vm',
			bindToController: true
		}
	});

package.json 的两个问题

image

  1. json-loader 应放到 devDependencies
    2.angular-es-utils 目前已经 2.1.2,依赖的这个版本有些低,看要不要升级

当多次调用,表格 refresh 方法,会发送多次请求

  1. 当多次调用 表格 refresh 方法,会发送多次请求,由于网络原因,返回顺序不一致,导致不是我期望的结果。举例说明:
    第一次,我通过 表格 refresh 方法 用过滤参数 job = ‘程序员’ 发送请求。
    间隔1秒
    第二次,我通过 表格 refresh 方法 用过滤参数 job = ‘QA’ 发送请求。

由于网络原因,第二次先返回,第一次后返回,表格显示第一次结果(程序员),我实际期望的是QA

建议是用 $cancelRequest, 取消上次请求。

// ...defining the `Hotel` resource...
var Hotel = $resource('/api/hotel/:id', {id: '@id'}, {
  // Let's make the `query()` method cancellable
  query: {method: 'get', isArray: true, cancellable: true}
});

// ...somewhere in the PlanVacationController...
...
this.onDestinationChanged = function onDestinationChanged(destination) {
  // We don't care about any pending request for hotels
  // in a different destination any more
  this.availableHotels.$cancelRequest();

  // Let's query for hotels in '<destination>'
  // (calls: /api/hotel?location=<destination>)
  this.availableHotels = Hotel.query({location: destination});
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.