总结最近移动端遇到的坑(auto-size + zepto)

问题一:移动端页面双击会放大,图片时大时正常,布局偶尔很丑。。刷新多遍又乜有问题

   解决:所有图片设置宽高100%,最外面的html,给个

<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-
scale=1.0,minimum-scale=1.0">

问题二:动态渲染页面时,最后一个子元素往往也有右边距,利用last-child来设置

li:last-child{
    margin-right: 0;
}

问题三:angular与react不同页面之间传值:最简单的例子,从注册页跳转到登录时,携带上username

angluar:

步骤一:在注册页

$scope.goReg =function(){
            $http
            .post("/users/register",{
                username:$scope.user.username,
                password:$scope.user.password,
                type:$scope.user.type
            })
            .success(function(data){
                if(eval(data)){
                    $state.go("login",{username:$scope.user.username});
                }else{
                    alert("用户名或密码不对");
                }
            });
        };

步骤二:在路由分发处:在分发login时,后面携带上即可

        .state('reg',{
            url:'/reg',
            templateUrl:"./html/reg.html",
            controller:"regCtrl"
        })
        .state('login',{
            url:'/login/:username',
            templateUrl:"./html/login.html",
            controller:"loginCtrl"
        })        

步骤三:在login的params中取出就好,比如直接打印$state就能在params中找到

        $scope.user={
	  username:$state.params.username,
	    password:""
		};
    

  

在react中,基本都一样,只是在注册页不一样,用ES6的语法拼接一下就好了

if (data) {
hashHistory.push(`/login/${values.username}`);
}

原文地址:https://www.cnblogs.com/zhaowenxin/p/6250512.html