Coder Social home page Coder Social logo

news's Introduction

News

Use Weui, Angular Or Vue prepared by the news client

基于 Angular.js Vue.js, Weui 和 Node.js 重写的新闻客户端, Live Demo

Made with ❤︎ by Wscats

Installation(Git)

克隆项目地址并下载(需要已安装Git),点击预览(移动端效果更佳)新增Vue2版本

git clone https://github.com/Wscats/news.git

启动服务(http://localhost:12345/news/index.html)

npm run dev

Building

通过npm安装本地服务第三方依赖模块(需要已安装Node.js),当然也可以先不安装依赖暂时省略这步,运行node http直接查看项目效果

npm install

然后执行gulp构建项目文件和打开服务器等

npm run test

Installation(NPM)

通过npm安装本地服务第三方依赖模块(需要已安装Node.js),当然也可以先不安装依赖暂时省略这步,运行node http直接查看项目效果

npm install

执行node指令运行http.js

node http

用浏览器打开链接

http://localhost:12345/news/index.html

License

MIT Copyright (c) 2019 ❤︎Wscats

news's People

Contributors

wscats 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  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  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

news's Issues

214

数据从后端到前端

font-end <-data-ajax back-end

数据从前端到后端

font-end ajax-data-> back-end
$scope,$http,{{}} 从后端把数据渲染到前端

ng-model

ng-model可以用在input textarea select
ng-model 跟 {{}}它们两个都可以渲染值
ng-model多了一个接受输入值的功能
双向数据绑定,$scope.name改变,ng-model="name", {{name}}
ng-model改变,其他两个也会改变

ng-click

把函数作为数据,绑定到html结构里面
html

<button ng-click="jk()">JK</button>

js

$scope.jk = function() {
				console.log('提交数据')
				$http.get('test.php', {
					params: {
						name: $scope.input
					}
				}).success(function(data) {

				})
			}

表达式

表达式可以算数运算,字符串拼接

{{name+name}}

表达式也支持三元表达式,相当于if()else{}

{{name?'a':'b'}}

news

NPM安装

npm安装名为20的模块

npm install 20

找到模块下载后的位置,在node_modules的20文件夹下

cd /node_modules/20

通过npm安装本地服务第三方依赖模块(需要已安装Node.js),当然也可以先不安装依赖暂时省略这步,运行node http直接查看项目效果

npm install

执行node指令运行http.js

node http

用浏览器打开链接

http://localhost:12345/news/index.html

后端使用的是PHP框架

触摸滑动

在对应控制器注入服务swipe

app.controller('autumnsCtrl', ['$scope', 'swipe', function($scope, swipe) {}])

在swipe对象上面执行method服务,并传入需要执行的回调函数
格式swipe.method([方向],[回调函数])
方向为四个top,bottom,left,right
回调函数的参数可以获取滑动前后的x和y坐标,并且方向的信息
具体是对象中的x1,x2,y1,y2属性,和direction属性
例如

swipe.method("bottom",function(e){
    console.log(e)
})

H5定位

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <title></title>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=jKaZX2RsTYAxYuq5wf2lCv6GaQfzYyin"></script>
    </head>
    <style>
        body,
        html,
        #allmap {
            width: 100%;
            height: 100%;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }
    </style>

    <body>
        <div id="allmap"></div>
    </body>
    <script>
        //h5 谷歌的方案
        function GetLocation() {
            //判断浏览器是否含有navigator对象geolocation属性
            if(navigator.geolocation) {
                //如果浏览器支持geolocation的话我们调用getCurrentPosition一个方法
                navigator.geolocation.getCurrentPosition(
                    //如果我们能从googleApi里面拿到定位信息我们就可以得到定位信息
                    function(position) {
                        //经纬度
                        console.log(position.coords.longitude);
                        console.log(position.coords.latitude);
                    },
                    //如果我们拿不到就返回错误信息
                    function(error) {
                        //百度方案
                        console.log(error);
                        //创建一个地图对象,并把地图渲染到id为allmap的标签元素上
                        var map = new BMap.Map("allmap");
                        //var point = new BMap.Point(116.331398, 39.897445);
                        //map.centerAndZoom(point, 12);
                        var geolocation = new BMap.Geolocation();
                        geolocation.getCurrentPosition(
                            //百度地图调用成功的回调
                            function(r) {
                                console.log(this);//输出geolocation对象
                                console.log(this.getStatus()); //输出现在的状态码
                                //关于状态码
                                //BMAP_STATUS_SUCCESS   检索成功。对应数值“0”。
                                //BMAP_STATUS_CITY_LIST 城市列表。对应数值“1”。
                                //BMAP_STATUS_UNKNOWN_LOCATION  位置结果未知。对应数值“2”。
                                //BMAP_STATUS_UNKNOWN_ROUTE 导航结果未知。对应数值“3”。
                                //BMAP_STATUS_INVALID_KEY   非法密钥。对应数值“4”。
                                //BMAP_STATUS_INVALID_REQUEST   非法请求。对应数值“5”。
                                //BMAP_STATUS_PERMISSION_DENIED 没有权限。对应数值“6”。(自 1.1 新增)
                                //BMAP_STATUS_SERVICE_UNAVAILABLE   服务不可用。对应数值“7”。(自 1.1 新增)
                                //BMAP_STATUS_TIMEOUT   超时。对应数值“8”。(自 1.1 新增)
                                if(this.getStatus() == BMAP_STATUS_SUCCESS) {
                                    var mark = new BMap.Marker(r.point); //打一个红点
                                    map.addOverlay(mark); //加标记到地图中
                                    map.panTo(r.point); //把标记移到对应的坐标
                                    //r.point 包含lat和long的坐标点
                                } else {
                                    alert("状态值出错");
                                }
                            },
                            //失败的回调
                            function(error) {

                            }
                        )
                    });
            }
        }
        GetLocation();
    </script>

</html>

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.