first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
::selection {
background: red;
color: #fff;
}
.box_1 {
width: 100px;
height: 100px;
background: yellowgreen;
position: relative;
}
p {
position: relative;
}
.box_1::after,
p::after {
content: '';
height: 1px;
background-color: #8d8d8d;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
}
.box_1 + div + div {
color: red;
}
a[href*="baidu"] {
color: red;
}
a[href*="xxx"] {
color: yellow;
}
</style>
</head>
<body>
<div class="main">
<div class="box_1"></div>
<div>22222</div>
<div>44444</div>
<p>wdf</p>
<a href="www.baidu.com">1</a>
<a href="www.xxx.com">2</a>
</div>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>响应式</title>
<style>
.box_1{
width: 200px;
height: 200px;
background: red;
}
@media screen and (min-width: 750px) and (max-width: 1080px) {
.box_1 {
background-color: royalblue;
}
}
@media screen and (max-width: 749px) {
.box_1 {
background-color: green;;
}
}
</style>
</head>
<body>
<div class="box_1">
</div>
</body>
</html>

View File

@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body{
height: 3000px;
margin: 0;
padding: 0;
}
.box {
width: 200px;
height: 200px;
float: left;
/* display: inline-block; */
}
.box-2_1 {
width: 100px;
height: 100px;
background: powderblue;
position: absolute;
left: 20px;
top: 20px;
z-index: 9;
}
.box-1 {
background: red;
position: relative;
}
.box-2 {
background: blue;
position: relative;
}
.box-3 {
position: relative;
background: yellow;
left: -100px;
top: 30px;
z-index: -1;
}
.box-4 {
background: green;
}
.box-5 {
background: palevioletred;
position: fixed;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<div class="box box-1">1</div>
<div class="box box-2">
<div class="box-2_1"></div>
</div>
<div class="box box-3">3</div>
<div class="box box-4">4</div>
<div class="box box-5">5</div>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 200px;
height: 200px;
padding: 10px;
background: red;
}
</style>
</head>
<body>
<div class="box">122</div>
</body>
</html>

View File

@@ -0,0 +1,46 @@
1盒子模型属性
外边距 margin
内边距 padding
border 边框
content 内容
盒子模型真实宽高 = width + height+ 内边距 + 边框
box-sizing: border-box; 去除盒子模型的计算规则,向内塌陷!!
2定位
相对定位 relative
1: 当一个元素被设置 相对定位 后,它原本位置没有被删除
2元素会被浮动
3: 定位参考对象是他自己的原本位置
绝对定位 absolute
1当一个元素被设置 绝对定位 后,它原本位置被删除,其他元素将会占据它的位置
2元素会被浮动
3定位参考对象
1如果有父元素父元素如果没有设置定位那么参考浏览器边框定位定位
2如果有父元素父元素设置定位那么参考父元素进行定位
固定定位 fixed
1 当一个元素被设置 相对定位 后,它原本位置被删除
2元素会被浮动
3定位参考对象是浏览器边框
流布局
nth-child
响应式:
1flex

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>过渡</title>
<style>
.box{
width: 200px;
height: 200px;
background-color: red;
transition: all 1s cubic-bezier(0.76, -0.49, 0, 1.99) 0s;
}
.box:hover {
width: 300px;
height: 300px;
}
@keyframes test {
from {
background-color: blue;
}
to {
background-color: red;
}
}
.box_2 {
width: 200px;
height: 200px;
background-color: blue;
animation: test 3s ease 1s infinite alternate forwards;
}
</style>
</head>
<body>
<div class="box"></div>
<div class="box_2 "></div>
</body>
</html>

View File

@@ -0,0 +1,61 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>纯css实现文字循环滚动效果</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.box {
width: 300px;
margin: 0 auto;
position: relative;
border: 1px solid #ff6700;
}
.animate {
padding-left: 20px;
font-size: 12px;
color: #000;
white-space: nowrap;
display: inline-block;
animation: 15s wordsLoop linear infinite normal;
}
@keyframes wordsLoop {
0% {
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
100% {
transform: translateX(-100%);
-webkit-transform: translateX(-100%);
}
}
@-webkit-keyframes wordsLoop {
0% {
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
100% {
transform: translateX(-100%);
-webkit-transform: translateX(-100%);
}
}
</style>
</head>
<body>
<div class="box">
<p class="animate">
君不见黄河之水天上来,奔流到海不复回,君不见高堂明镜悲白发,朝如青丝暮成雪,人生得意须尽欢,莫使金樽空对月
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,23 @@
# flex学习
## 分类
display: flex; 加在父元素上
- 1用在父元素身6个
justify-content: 决定元素在x轴的对齐方式
align-items决定元素在y轴的对齐方式
flex-wrap: 决定元素是否换行
flex-direction决定元素的排列方向
- 2用在子元素上6个
order: 数值越小,元素越靠前
flex-grow定义元素的放大比例
flex-shrink定义元素的缩小比例

View File

@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
h1 {
border-bottom: 1px solid #8d8d8d;
}
</style>
</head>
<body>
<h1>576</h1>
<h2>2</h2>
<h3>3</h3>
<h4>4</h4>
<h5>5</h5>
<h5>5</h5>
<h6>6</h6>
<select name="" id="">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
</select>
<input type="text" placeholder="请输入账号">
<input type="password" placeholder="请输入密码">
<input type="file">
<input type="color" placeholder="请输入账号">
<input type="number" placeholder="请输入手机号">
<input type="button" value="登录">
<input type="date">
<input type="radio" name="dd">
<input type="radio" name="dd">
<input type="radio" name="dd">
<input type="checkbox">
<button>登录</button>
<div>div</div>
<span>span frwkvkr</span>
<p>p</p>
<form action="" method="GET">
<input type="text" placeholder="用户名">
<input type="password" placeholder="用户名">
<input type="submit" value="提交">
</form>
<table>
<th></th>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<i class=""></i>
<i>sdvfergver</i>
<img src="https://www.baidu.com/img/bd_logo1.png" alt="图片无法显示">
<iframe width="440px" height="600px" src="https://pc.qq.com/detail/13/detail_22693.html" frameborder="0"></iframe>
<ol>
<li>测试任务分为</li>
</ol>
<ul>
<li>222</li>
</ul>
<!-- <video src="" controls poster="" loop autoplay muted></video>
<audio src="" controls loop autoplay muted></audio> -->
<a href="https://pc.qq.com/detail/13/detail_22693.html" target="_blank">分为非热敷</a>
<pre>
@Reflect.metadata('name', 'A')
class A {
@Reflect.metadata('name', 'hello')
hello() {}
}
const objs = [A, new A, A.prototype]
const res = objs.map(obj => [
Reflect.getMetadata('name', obj),
Reflect.getMetadata('name', obj, 'hello'),
Reflect.getOwnMetadata('name', obj),
Reflect.getOwnMetadata('name', obj ,'hello')
])
</pre>
<del>fwefewf</del>
<p>cdcd <sup>dd</sup></p>
<p></p>
</body>
<script></script>
</html>

View File

@@ -0,0 +1,57 @@
Git 版本控制工(存代码)
github git的web管理界面
linux
git add -A
git commit -m "fwfewfewfe"
git push
git clone xxxxxx
一定要先拉取
再推送
解决冲突(手工合并代码)
标签的分类:
1块级标签
独占一行的标签
divh1~h2pulli
2行内标签
不会独占一行的标签
任务:
时间2晚上7月29号晚上带来
1韩想 https://you.163.com/?from=search_pz_baidu_29
2赵俊凯 https://music.163.com/
网站开发:
1后端渲染
前端:写静态页面(10%)
后端:(90%)
劣势:
2前后端分离
前端:写页面,实现功能,渲染数据 50%
接口+ajax
后端:实现数据接口,部署网站 50%

View File

@@ -0,0 +1,2 @@
flex
rem

View File

@@ -0,0 +1,16 @@
/* 专门用来重置浏览器默认样式的 */
body, p,ul,li,h1,h2,h3,h4,h5,h6,input{
margin: 0;
padding: 0;
}
input {
outline: none;
}
li {
list-style: none;
}
a {
text-decoration: none;
}

View File

@@ -0,0 +1,126 @@
.header {
width: 100%;
height: 2.5rem;
background-color: #000000;
opacity: 0.7;
position: fixed;
left: 0;
top: 0;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0.6rem;
box-sizing: border-box;
}
.open {
width: 3.6rem;
height: 1.3rem;
background-color: #d0302c;
border-radius: 0.2rem;
font-family: PingFangSC-Medium;
font-size: 0.6rem;
color: #ffffff;
text-align: center;
line-height: 1.3rem;
}
.header img {
height: 1.625rem;
}
.content {
margin-top: 50px;
}
.video {
height: 211px;
}
.video .banner {
width: 100%;
}
.video_info {
position: relative;
}
.video_info::after {
content: "";
position: absolute;
width: 100%;
transform: scaleY(0.5);
height: 1px;
bottom: -10px;
left: 0;
background: #e5e5e5;
}
.video_info .title{
font-family: PingFangSC-Bold;
font-size: 0.9rem;
line-height: 1.425rem;
color: #333333;
margin-top: 1.475rem;
margin-bottom: 0.75rem;
}
.video_info .time{
font-family: PingFangSC-Medium;
font-size: 0.575rem;
color: #999999;
margin-bottom: 0.675rem;
}
.video_info .video_action{
display: flex;
justify-content: space-between;
}
.video_action .action_left{
display: flex;
}
.video_action img{
width: 0.65rem;
vertical-align: middle;
}
.video_action span{
font-family: PingFangSC-Medium;
font-size: 0.6rem;
color: #999;
}
.video_action .collect{
margin-right: 1.5rem;
}
.about{}
.about .title{
height: 2.5rem;
line-height: 2.5rem;
margin-top: 0.45rem;
}
.about .content_1{
overflow-x: scroll;
}
.about .content_1 ul{
display: flex;
}
.about .content_1 ul li{
width: 6.85rem;
margin-right: 0.275rem;
}
.about .content_1 .pic{
position: relative;
width: 6.85rem;
height: 3.9rem;
}
.about .content_1 .pic img{
width: 100%;
height: 100%;
}
.about .content_1 .pic span{
position: absolute;
font-family: PingFangSC-Medium;
font-size: 0.55rem;
color: #ffffff;
right: 0.325rem;
bottom: 0.325rem;
}
.about .content_1 .mess{
font-size: 0.7rem;
line-height: 1.175rem;
color: #666;
margin-top: 0.6rem;
}

View File

@@ -0,0 +1,16 @@
/* 存放公共css的 */
.theme_red {
color: blue;
}
.left {
float: left;
}
.right {
float: right;
}
.p_575 {
padding: 0 0.575rem;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -0,0 +1,126 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>rem</title>
<link rel="stylesheet" href="./css/clear.css">
<link rel="stylesheet" href="./css/public.css">
<link rel="stylesheet" href="./css/index.css">
<style>
html {
font-size: 20px;
}
@media only screen and (min-width: 400px) {
html {
font-size: 21.33333333px !important;
}
}
@media only screen and (min-width: 414px) {
html {
font-size: 22.08px !important;
}
}
@media only screen and (min-width: 480px) {
html {
font-size: 25.6px !important;
}
}
</style>
</head>
<body>
<div class="header">
<img src="./img/logo.png" alt="">
<div class="open">打开</div>
</div>
<div class="content">
<div class="video">
<img class="banner" src="./img/banner.png" alt="">
</div>
<div class="video_info p_575">
<p class="title">香港24小时 | 8月25日发生了什么暴力局面再次升级</p>
<div class="time">2019-04-30 10:45</div>
<div class="video_action">
<div class="action_left">
<div class="collect">
<img src="./img/collect_small.png" alt="">
<span>收藏</span>
</div>
<div class="zan">
<img src="./img/collect_small.png" alt="">
<span>12</span>
</div>
</div>
<div class="action_right">
<span>简介</span>
<img src="./img/collect_small.png" alt="">
</div>
</div>
</div>
<div class="about p_575">
<div class="title">相关推荐</div>
<div class="content_1">
<ul>
<li>
<div class="pic">
<img src="./img/banner.png" alt="">
<span>03:07</span>
</div>
<div class="mess">
一生中总要有个夏天给海岛我的9天8夜
</div>
</li>
<li>
<div class="pic">
<img src="./img/banner.png" alt="">
<span>03:07</span>
</div>
<div class="mess">
一生中总要有个夏天给海岛我的9天8夜
</div>
</li>
<li>
<div class="pic">
<img src="./img/banner.png" alt="">
<span>03:07</span>
</div>
<div class="mess">
一生中总要有个夏天给海岛我的9天8夜
</div>
</li>
<li>
<div class="pic">
<img src="./img/banner.png" alt="">
<span>03:07</span>
</div>
<div class="mess">
一生中总要有个夏天给海岛我的9天8夜
</div>
</li>
<li>
<div class="pic">
<img src="./img/banner.png" alt="">
<span>03:07</span>
</div>
<div class="mess">
一生中总要有个夏天给海岛我的9天8夜
</div>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,13 @@
flex
rem :响应式的尺寸单位
基准值
网页默认的基准值(html) 16px
实现基准值修改:
1css 媒体查询
2js

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>函数</title>
</head>
<body>
</body>
<script>
// 函数(方法)作用:将代码进行分类(封装)
// 回调
// function UserName(name) {
// name("ddddd")
// }
// UserName( function(res) {
// console.log(res);
// })
// // 作用域
// var a = 2;
// function name() {
// var c = 1;
// console.log(c); // 1
// }
// name()
// console.log(a);
// console.log(c);
// function name () {
// console.log(arguments);
// }
// name(1,2,3,4,5,6,7,8,9)
</script>
</html>

View File

@@ -0,0 +1,106 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
var UserName = "张三"
const UserNames = "李四"
// 数据类型
// numberstringarrayobject nullundefinedfunction boolean
// var a = 1;
// var b = '2'; // "2"
// console.log(b-a); //
// + 两边都是number 加法
// + 只要有一个是string拼接字符串
// - 没有特殊情况
// array 数组
// let aa = new Array();
// aa[0] = "1"
// aa[1] = "2"
// aa[2] = "3"
// console.log(aa);
// var aa = new Array(1,2,"dewdew");
// console.log(aa);
// var aa = [1,2,3]
// aa.unshift(4)
// console.log(aa);
// var obj = new Object();
// var obj = new Object({ name: '李兵', age: 1 });
var obj = {
name: '李兵',
age: 1,
like: ['骑车','编程'],
hello: function() {
console.log("hello")
}
}
// let a = Object.keys(obj)
// console.log(a);
// for(var i=0;i< a.length;i++) {
// console.log(obj[a[i]]);
// }
// for (var key in obj) {
// console.log(obj[key])
// }
var a = ['好','22','我的娃'];
// a.forEach(function(val,index,arr){
// //console.log(val);
// })
let b = ['3ds','3dsadc']
// for (var index = 0; index < b.length; index++) {
// a.push(b[index])
// }
// a.concat(b)
// console.log(a);
// 扩展运算符
// console.log( [ ...a, ...b ] );
// obj.hasOwnProperty("love") // true false
// let text = "name"
// obj.hello()
// console.log(obj.text);
// console.log(obj[text]);
// var a = 1, b = 2;
// console.log(++a); // 2
// console.log(b--); // 2
// console.log(b); // 1
// console.log( ++(a--) - ( (a++) - (--b) ) ); //
</script>
</html>

View File

@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tabs切换</title>
<style>
body,ul,li{
margin: 0;
padding: 0;
list-style: none;
}
ul {
overflow: hidden;
}
.tab_title li {
margin-right: 15px;
}
.tab_title li,
.tab_content li {
float: left;
}
.tab_content li {
display: none;
}
.title_active {
color: red !important;
}
.content_active {
display: block !important;
}
</style>
</head>
<body>
<div class="tab">
<ul class="tab_title">
<li class="title_active">百货</li>
<li>宠物</li>
<li>零食</li>
</ul>
<ul class="tab_content">
<li class="content_active">百货的内容</li>
<li>宠物的内容</li>
<li>零食的内容</li>
</ul>
</div>
</body>
<script>
var tabTitle = document.querySelectorAll(".tab_title li");
var tabContent = document.querySelectorAll(".tab_content li")
console.log(tabTitle);
// 循环遍历所有的tabs标题
tabTitle.forEach(function(val,index){
// 为三个tabs标题的li标签统一绑定上事件
val.onclick = function() {
// 循环遍历所有的tabs标题 把标题li标签上的class全部置空
tabTitle.forEach(function(v,i) {
// 清除标题li上的class
v.className = ""
// 清除内容li上的class
tabContent[i].className = ""
})
// 为你点击的那个标题的li标签加上激活样式
val.className = "title_active"
// 为你点击的那个内容的li标签加上激活样式
tabContent[index].className = "content_active"
}
})
</script>
</html>

View File

@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tabs切换</title>
<style>
body,ul,li{
margin: 0;
padding: 0;
list-style: none;
}
ul {
overflow: hidden;
}
.tab_title li {
margin-right: 15px;
}
.tab_title li,
.tab_content li {
float: left;
}
.tab_content .tab_item {
display: none;
}
.title_active {
color: red !important;
}
.content_active {
display: block !important;
}
</style>
</head>
<body>
<div class="tab">
<ul class="tab_title">
</ul>
<div class="tab_content">
</div>
</div>
</body>
<script>
// json 数据
var tabs = [
{
title: '百货',
content: [
{ text: '百货的内容1' },
{ text: '百货的内容2' },
]
},
{
title: '宠物',
content: [
{ text: '宠物的内容1' },
{ text: '宠物的内容2' },
{ text: '宠物的内容3' }
]
},
{
title: '生活',
content: [
{ text: '生活的内容1' },
{ text: '生活的内容2' },
{ text: '生活的内容3' }
]
},
];
var currentIndex = 0;
// 渲染tabs的标题
function RenderTitle() {
var ul = document.querySelector(".tab_title");
tabs.forEach(function(val, index, arr){
ul.innerHTML += `<li class="${ index == 0 ? 'title_active' : '' }">${val.title}</li>`
});
var li = document.querySelectorAll(".tab_title li");
li.forEach(function(c,r) {
c.onclick = function () {
li.forEach(function(e,v) {
e.className = ""
})
c.className = "title_active"
currentIndex = r
innerContent()
}
});
}
function RenderContent() {
// 完成第一步tab_item的渲染
var contentFather = document.querySelector(".tab_content");
tabs.forEach(function(v,i){
contentFather.innerHTML += `<div class="tab_item ${ i == 0 ? 'content_active' : ''}"></div>`
});
innerContent();
}
function innerContent() {
var tabItem = document.querySelectorAll(".tab_content .tab_item")
tabItem.forEach(function(t,b){
t.className = "tab_item"
});
tabItem[currentIndex].className = "tab_item content_active";
if (tabItem[currentIndex].innerHTML.length == 0) {
tabs[currentIndex].content.forEach(function(v,i){
tabItem[currentIndex].innerHTML += `<p>${v.text}</p>`
});
}
}
RenderTitle()
RenderContent()
</script>
</html>

View File

@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>百度搜索建议</title>
<style>
body,
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
</style>
</head>
<body>
<input type="text" placeholder="输入关键词">
<ul>
</ul>
</body>
<script>
// => 箭头函数function简写
// var name = fn() => {
// }
// var name = () => {
// }
var keyWordList = [
'今天', '今天天气不好', '天气是雨天', 'html', 'html学习', '不喜欢html',
'编程学习', '学习代码', '喜欢编程',
];
var newList = []
var input = document.querySelector("input");
var ul = document.querySelector("ul");
input.oninput = function () {
newList = []
if (input.value.length != 0) {
keyWordList.forEach(function (val, index) {
if (val.indexOf(input.value) > -1) {
// 获取 用户输入关键字在原字符串中的下标
let stringIndex = val.indexOf(input.value);
// 使用 substring 方法,提取 原字符串中 的 符合用户输入的字符
// let activeString = `<span style="color:red">${val.substring(stringIndex, stringIndex + input.value.length)}</span>`;
let activeString = `<span style="color:red">${input.value}</span>`;
// 替换原字符串中的关键词为带span的关键字
let newVal = val.replace(input.value, activeString)
newList.push(newVal)
}
});
ul.innerHTML = ""
newList.forEach(function (val, index) {
ul.innerHTML += `<li>${val}</li>`
})
console.log(newList);
} else {
ul.innerHTML = ""
}
}
</script>
</html>

View File

@@ -0,0 +1,13 @@
1document dom操作
2window bom 操作
变量:能够被重新赋值的叫变量
常量:不能被修改的
es5 // 低版本js语法
es6,7,8,9 高版本的js语法

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>留言字数限制</title>
<style>
body {
margin: 0;
padding: 0;
}
.main {
width: 400px;
height: 200px;
border: 1px solid #000;
position: relative;
}
.main span {
position: absolute;
right: 10px;
bottom: 10px;
}
textarea {
width: 100%;
height: 100%;
resize: none;
}
</style>
</head>
<body>
<div class="main">
<textarea name="" id="" cols="30" rows="10"></textarea>
<span>0/10</span>
</div>
</body>
<script>
var numberLength = 10;
var text = document.querySelector("textarea");
var span = document.querySelector("span");
text.oninput = function () {
if (numberLength - text.value.length > 0) {
var tipsText = `${text.value.length}/剩余${numberLength - text.value.length}`
span.innerText = tipsText;
} else {
text.value = text.value.substring(0,numberLength)
span.innerText = '超过字数限制';
}
}
</script>
</html>

View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>社会主义核心价值观</title>
<style>
body,html{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
span {
transition: all 1s cubic-bezier(1, 0.18, 0.46, 0.99) 0s;
position: fixed;
font-size: 20px;
user-select:none;
}
</style>
</head>
<body>
</body>
<script>
var body = document.querySelector("body"), i = -1;
body.onclick = function (e) {
var TextArray = ["富强","民主", "文明", "和谐","自由", "平等", "公正","法治", "爱国", "敬业","诚信", "友善"];
i++
if (i > TextArray.length-1) {
i = 0
}
var x = e.offsetX, y = e.offsetY, move = y - 30;
var span = document.createElement("span");
span.innerText = TextArray[i];
var colors = Math.round(Math.random()*360);
span.style.cssText = `
left: ${x}px;
top: ${move}px;
opacity: 1;
color: hsla(${colors},100%,50%,1);
`;
body.appendChild(span)
setTimeout(function(){
span.style.cssText = `
left: ${x}px;
top: ${move - 150}px;
opacity: 0;
color: hsla(${colors},100%,50%,1);
`;
}, 200)
setTimeout(function(){
body.removeChild(span)
}, 1300)
}
</script>
</html>

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<ul>
</ul>
</body>
<!--<script>-->
<!-- function dnkjdn(res) {-->
<!-- console.log(res)-->
<!-- }-->
<!--</script>-->
<!--<script src="http://127.0.0.1:3000/api/index?callback=dnkjdn"></script>-->
<script>
// 前端 http://localhost:63342/2020-08-17/ajax.html
// 后端 http://127.0.0.1:3000/api/index
// 域名,端口,协议
// 拿出电话
var http = new XMLHttpRequest();
// GET, POST, PUT, DELETE, OPTION
// 设置电话号码
http.open("GET","http://127.0.0.1:3000/api/zj");
// 拨打电话
http.send()
http.onreadystatechange = function () {
if(http.readyState == 4) {
if (http.status == 200) {
var res = JSON.parse(http.responseText)
console.log(res)
// res.data.forEach((val,index) => {
// document.querySelector("ul").innerHTML+=`<li>${val.title}</li>`
// });
} else {
alert("网络不好")
}
}
}
// ajax({
// method: 'GET',
// url: 'xxxx',
// success: function (res) {
//
// },
// error: function (erro) {
//
// }
// })
</script>
</html>

View File

@@ -0,0 +1,15 @@
const express = require('express')
const app = express()
const port = 4000
app.get('/api/br', (req, res) => {
var methods = req.query.callback
var dd = {
title: '别人的后端',
};
res.json(dd)
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`))

View File

@@ -0,0 +1,18 @@
const express = require('express')
const request = require('request')
const app = express()
const port = 3000
app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Content-Type', 'application/json;charset=utf-8');
next();
});
app.get('/api/zj', (req, res) => {
request('http://127.0.0.1:4000/api/br', function (error, response, body) {
res.json(body)
});
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`))

View File

@@ -0,0 +1,17 @@
{
"name": "ddd",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"express": "^4.17.1",
"request": "^2.88.2"
},
"devDependencies": {},
"scripts": {
"dev": "node-dev index.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}

View File

@@ -0,0 +1,37 @@
ajax 是一种无刷新的前后端数据交互的方式
后端渲染
后端:页面 + 功能 + 数据dba + 安全 + 服务器(运维)
前端:页面
前端分离
后端:使用任意后端语言实现接口
数据
前端:使用任意框架实现页面和功能
页面+功能
前端 --ajax--> 后端
ajax 跨域
解决ajax跨域
作业明天晚上上课告诉我ajax跨域是什么大致有哪些解决办法
ajax跨域 浏览器拦截导致的!
1: js <== jsonp 注意它不是ajax请求是js资源文件请求
2: cors(Access-Control-Allow-Origin) 后端设置的,和前端无关
3服务端代理
A(自己前端) ==跨域===> C(别人后端)
A(自己前端) =====> B(自己后端)
B(自己后端) =====> C(别人后端)

View File

@@ -0,0 +1,47 @@
var URL = "http://m.imomoe.in/";
// var iconv = require('iconv-lite');
const cheerio = require('cheerio');
const fs = require("fs")
const request = require('request');
var infoHtml = 'https://www.90tu.com/xingganmeinv/8552.html';
// request('https://www.90tu.com/xingganmeinv/', function (error, response, body) {
// console.log(body);
// var $ = cheerio.load(body)
// $(".clearh10").parent().find("ul li").each(function(){
// let imgUrl = $(this).find("img").attr("src")
// console.log();
// request(imgUrl).pipe(fs.createWriteStream(`./img/${$(this).find("span").text()}.png`))
// });
// });
request(infoHtml, function (error, response, body) {
var $ = cheerio.load(body)
let lastA = $(".page1 a")[$(".page1 a").length - 1];
var url = $(lastA).attr("href");
var totalPage = url.match(/_([\s\S]*?).html/)[1];
for (var i=1;i<=totalPage;i++) {
if (i == 1) {
DownImg($(".spanlr a img").attr("src"))
} else {
let a = `https://www.90tu.com/xingganmeinv/8552_${i}.html`
console.log(a);
get(a)
}
}
});
function get(url) {
request(url, function (error, response, body) {
var $ = cheerio.load(body);
DownImg($(".spanlr a img").attr("src"))
})
}
function DownImg(url) {
request(url).pipe(fs.createWriteStream(`./img/${Math.random(0,100)}${(new Date()).valueOf()}.png`))
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
后端html文件
</body>
</html>

View File

@@ -0,0 +1,4 @@
var utils = require("./utils")
console.log(utils.testTwo());

View File

@@ -0,0 +1,17 @@
{
"name": "2020-09-01",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cheerio": "^1.0.0-rc.3",
"iconv-lite": "^0.6.2",
"request": "^2.88.2"
}
}

View File

@@ -0,0 +1,19 @@
var http = require("http");
var url = require("url");
var fs = require("fs");
function start() {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
var html = fs.readFileSync("./index.html", 'UTF-8').toString()
console.log(html);
response.writeHead(200, {"Content-Type": "text/html;charset=UTF-8"});
response.write(html);
response.end();
}
http.createServer(onRequest).listen(8888);
console.log("Server has started.");
}
start();

View File

@@ -0,0 +1,22 @@
// module.exports = {
// test() {
// return "哈哈哈哈哈"
// }
// }
exports.testOne = function() {
return "testOne"
}
exports.testTwo = function() {
return "testTwo"
}
exports.testThree = function() {
return "testThree"
}
{
}

View File

@@ -0,0 +1,122 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue 学习</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
.active {
color: red;
}
</style>
</head>
<body>
<div class="dd">
<h2>{{text}}</h2>
<a :href="href" :title="text">{{text}}</a>
<p v-text="test"></p>
<ul>
<li @click="testa(v.title)" v-for="v,i in list">
下标:{{i}} {{ v.title }}
</li>
</ul>
<ul>
<li v-for="v, k,index in obj">
index: {{index}} v: {{v}} k: {{k}}
</li>
</ul>
<p v-if="isShow">v-if 登录过 可以看</p>
<p v-else>没登录过 不能看</p>
<!-- <div v-if="type === 'A'">
A
</div>
<div v-else-if="type === 'B'">
B
</div>
<div v-else-if="type === 'C'">
C
</div>
<div v-else>
Not A/B/C
</div> -->
<p v-show="showH">v-show</p>
<a href="" @click.prevent="testAlert">点我弹窗</a>
<div @click="f1(3)" style="width: 100px;height: 100px;background-color: aqua;">
<div @click.stop="c1" style="width: 50px;height: 50px;background-color: red;">
www
</div>
</div>
<input type="text" v-model="inputModel">
{{ inputModel }}
<span v-pre>{{ inputModel }}</span>
<div :class="{ active: false }">哈哈哈</div>
</div>
</body>
<script>
// 数据双向绑定
// vue的指令 vue自定义的一些html标签上的 属性
// v-bind 作用将变量绑定到标签的属性上 简写 :
// v-text
// v-html
// v-for
// v-if 如果为false 会将dom删除true 重新添加 数据量小的情况下
// v-show 数据量大的时候进行显示隐藏
// v-on 绑定事件 @
// v-model 给input用的
var vm = new Vue({
el: '.dd',
// 变量的定义必须放到data内部
data: {
text: '哈哈哈哈',
href: 'http://www.baidu.com',
showH: false,
inputModel: 'inputModel',
list: [
{ id: 1,title: '测试1' },
{ id: 2,title: '测试2' },
{ id: 3,title: '测试3' },
],
isShow: false,
obj: {
name: 'lb',
age: 18,
id: 1
},
test: '<h2>v-text</h2>'
},
// 专门放方法
methods: {
testa(ti) {
alert(ti)
},
f1(name) {
alert("f1: "+name)
},
c1() {
alert("c1")
},
testAlert() {
alert("哈哈哈哈")
}
}
})
</script>
</html>

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
ul,li {
list-style: none;
margin: 0;
padding: 0;
}
ul {
overflow: hidden;
}
li {
float: left;
margin-right: 10px;
}
.active {
color: red;
}
</style>
</head>
<body>
<div class="app">
<ul>
<li v-for="item,index in tabs"
:class="index == ActiveIndex ? 'active' : '' "
@click="changeTabs(index)"
:key="index">
{{ item.title }}
</li>
</ul>
<div class="div">{{ tabs[ActiveIndex].content }}</div>
</div>
</body>
<script>
new Vue({
el: '.app',
data: {
ActiveIndex: 0,
tabs: [
{ id: 1, title: '热门', content: '热门内容' },
{ id: 2, title: '推荐', content: '推荐内容' },
{ id: 3, title: '军事', content: '军事内容' },
{ id: 4, title: '社会', content: '社会内容' },
]
},
methods: {
changeTabs(ix) {
this.ActiveIndex = ix;
}
}
})
</script>
</html>

View File

@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
ul,
.title {
list-style: none;
margin: 0;
padding: 0;
}
.title {
overflow: hidden;
}
.title p {
float: left;
margin-right: 10px;
}
.active {
color: red;
}
</style>
</head>
<body>
<div class="app">
<div class="title">
<p v-for="item,index in tabs" :key="index" :class="index == ActiveIndex ? 'active' : '' "
@click="changeTabs(index)">
{{ item.title }}
</p>
</div>
<div class="content" v-show="index == ActiveIndex" v-for="z,index in tabs.length">
<p v-for="v,i in tabs[ActiveIndex].content">{{v.nr}}</p>
</div>
</div>
</div>
</body>
<script>
new Vue({
el: '.app',
data: {
ActiveIndex: 0,
tabs: [
{
id: 1, title: '热门', content: [
{ id: 1, nr: '333' },
{ id: 2, nr: '33' },
{ id: 3, nr: '44' },
]
},
{
id: 2, title: '推荐', content: [
{ id: 1, nr: 'dd' },
{ id: 2, nr: 'cc' },
{ id: 3, nr: '222' },
]
}
]
},
methods: {
changeTabs(ix) {
this.ActiveIndex = ix;
}
}
})
</script>
</html>

View File

@@ -0,0 +1,28 @@
- vue
- react
- angular
mvvm 前端框架
model view viewmodel
js jqdom操作
三大框架:数据驱动页面
mvc
model 层 数据层
view 层 视图(页面)
controller 层 控制器
用户 --->controller--> vie and model
vie and model --> controller --> 浏览器 ---> 用户

View File

@@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div class="app">
<l-header @tzhaha="getChildren" :item-list="FList"></l-header>
<p> {{ UserName | test}}</p>
<h2 ref="sb">{{hello}}</h2>
<div class="name">
<input type="text" @input="checkUserName" v-check="UserName" v-model="UserName" placeholder="用户名">
<span>{{tips}}</span>
</div>
<l-foote>
<template v-slot:left>
<span>左边图标</span>
</template>
<template v-slot:right>
<span>我的</span>
</template>
</l-foote>
</div>
</body>
<script>
var PageParams = {
data: {
mixinsOne: 'mixinsOne',
params: {
page: 1,
limit: 10
}
},
}
Vue.component('l-foote',{
template: `
<div>
<slot name="left"></slot>
<l-header @tzhaha="test" :item-list="[3,4,5,6,7,8,9]">></l-header>
<h2>底部版权</h2>
<slot name="right"></slot>
</div>
`,
methods: {
test() {
alert("1111")
}
}
})
// 子组件
Vue.component('l-header',{
props: {
itemList: {
type: Array,
default: [1,2]
}
},
template: `<ul>
<li v-for="item in itemList">{{ item }}</li>
<button @click="TzFather">下一页</button>
</ul>`,
data() {
return {
list: ['344','3435','5668']
}
},
methods: {
TzFather() {
this.$emit("tzhaha",11)
}
}
})
// 父组件
// v-lb
vm = new Vue({
el: '.app',
mixins: [PageParams],
data: {
hello: '11',
UserName: 'dewrdewfeetgrttwefergrthr',
tips: '',
FList: ['09','sds','去的汪峰的']
},
filters: {
test(val) {
return val.substring(0,4)+"..."
}
},
directives: {
check: {
inserted(el, bind) {
console.log(bind);
document.title = bind.expression
}
}
},
beforeCreate() {
// console.log("beforeCreate");
// console.log(this.hello);
},
created() {
// console.log("111: ",this.$refs.sb);
// console.log(this.hello);
},
mounted() {
// console.log(this.$refs.sb);
// console.log(this.hello);
// this.mixins222()
},
methods: {
getChildren(val) {
alert("父组件收到的数值为:"+val)
},
checkUserName() {
if (this.UserName.length <6){
this.tips = "用户名不能少于6个字符"
} else {
this.tips = ""
}
}
},
watch: {
hello(newVal, oval) {
// console.log("newVal: ", newVal);
// console.log("oval: ", oval);
}
},
computed: {
test() {
return "22222"
}
}
})
</script>
</html>

View File

@@ -0,0 +1,19 @@
【完成】1计算属性和侦听器
【完成】2组件基础
全局组件
局部组件
组件间数据传递
父 ---> 子props
子 ---> 父:$emit 子组件通过$emit提交事件通知父组件父组件捕捉事件通知执行自己的对应逻辑
【完成】3插槽
【完成】4自定义指令
【完成】5混入
【完成】7过滤器
// 6进入/离开 & 列表过渡
【完成】8生命周期

View File

@@ -0,0 +1,42 @@
局部组件
vue 全家桶
vue-router 路由(页面)
vuex 全局数据存储
axios 发送ajax的插件
element pc端 ui 做管理后台
vant 移动端
vue-cli
2.x
3.x
ESLint
路由参数传递:
params 传参 http://www.xxx.com/info/1/2 组合 name 使用 this.$route.params
query 传参 http://www.xxx.com/info?url=1&page=2 使用 this.$route.query
http://www.xxx.com/User // 我的页面首页
http://www.xxx.com/User/Setting // 我的页面中 设置页面
http://www.xxx.com/User/About // 我的页面中 关于我页面

View File

@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<style>
.router-link-active {
color: red;
}
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
}
</style>
</head>
<body>
<div id="app">
<h1>Hello App!</h1>
<p>
<!-- 使用 router-link 组件来导航. -->
<!-- 通过传入 `to` 属性指定链接. -->
<!-- <router-link> 默认会被渲染成一个 `<a>` 标签 -->
<router-link :to="{ name: 'zs' }">Go to Foo</router-link>
<!-- <router-link :to="{ path: '/bar', query: { url: '1222', page: '1' } }">Go to Bar</router-link> -->
<router-link :to="{ name: 'foo', params: { url: '1222', page: '1' } }">Go to Bar</router-link>
<router-link to="/me">我的</router-link>
</p>
<!-- 路由出口 -->
<!-- 路由匹配到的组件将渲染在这里 -->
<transition name="fade">
<router-view></router-view>
</transition>
</div>
</body>
<script>
// 0. 如果使用模块化机制编程导入Vue和VueRouter要调用 Vue.use(VueRouter)
// 1. 定义 (路由) 组件。
// 可以从其他文件 import 进来
const Foo = { template: '<div>foo</div>' }
const Login = { template: '<div>登录页面</div>' }
const Me = { template: '<div>我的页面</div>' }
const error = { template: '<div>404错误页面</div>' }
const Bar = {
data() {
return {
params: this.$route.params
}
},
created() {
// document.title = "详情页"
},
template: `
<div>详情 {{params.url}} {{params.page}}</div>
`,
}
// 2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是
// 通过 Vue.extend() 创建的组件构造器,
// 或者,只是一个组件配置对象。
// 我们晚点再讨论嵌套路由。
const routes = [
{
path: '*',
redirect: { name: 'error' }
},
{ path: '/User/foo', component: Foo, name: 'zs', meta: { title: '详情页', isLogin: false } },
{ path: '/Error', component: error, name: 'error', isLogin: false },
{ path: '/User/bar/:url/:page', component: Bar, name: 'foo', meta: { title: 'bar页面', isLogin: false } },
{ path: '/me', component: Me, name: 'me', meta: { title: '我的页面', isLogin: true } },
{ path: '/login', component: Login, name: 'login', meta: { title: '登录页面', isLogin: false } },
]
// 3. 创建 router 实例,然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
})
router.beforeEach(function(to, from, next) {
console.log("to: ", to);
// 需要登录才能查看的
if (to.meta.isLogin) {
// 登录过了
if (localStorage.getItem("token") !== null) {
next()
// 没有登录
} else {
next({
path: '/login',
query: {
fromPage: from.path
}
})
}
// 不需要登录
} else {
next()
}
document.title = to.meta.title
next()
})
// 4. 创建和挂载根实例。
// 记得要通过 router 配置参数注入路由,
// 从而让整个应用都有路由功能
const app = new Vue({
el: '#app',
router
})
</script>
</html>

View File

@@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}

View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View File

@@ -0,0 +1,4 @@
/build/
/config/
/dist/
/*.js

View File

@@ -0,0 +1,29 @@
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}

View File

@@ -0,0 +1,14 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

View File

@@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}

View File

@@ -0,0 +1,21 @@
# vuestudy
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

View File

@@ -0,0 +1,41 @@
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})

View File

@@ -0,0 +1,54 @@
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,102 @@
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
minimize: process.env.NODE_ENV === 'production',
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}

View File

@@ -0,0 +1,22 @@
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}

View File

@@ -0,0 +1,93 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'@img': resolve('src/assets/img')
}
},
module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}

View File

@@ -0,0 +1,95 @@
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})

View File

@@ -0,0 +1,145 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

View File

@@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})

View File

@@ -0,0 +1,76 @@
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: false,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
/**
* Source Maps
*/
productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}

View File

@@ -0,0 +1,4 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>vuestudy</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,77 @@
{
"name": "vuestudy",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "bmy <2271608011@qq.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"lint": "eslint --ext .js,.vue src",
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.20.0",
"lib-flexible": "^0.3.2",
"vant": "^2.10.4",
"vue": "^2.6.12",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"px2rem-loader": "^0.1.9",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

View File

@@ -0,0 +1,36 @@
<template>
<div id="app">
<NavBar :t-name="title"></NavBar>
<router-view @Title="SetTitle"/>
<TarBar></TarBar>
</div>
</template>
<script>
// 1引入组件
import NavBar from './components/NavBar'
import TarBar from './components/TabBar'
export default {
name: 'App',
data () {
return {
title: '首页'
}
},
methods: {
SetTitle (val) {
console.log(val)
this.title = val
}
},
// 注册组件
components: {
NavBar,
TarBar
}
}
</script>
<style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,113 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<ul>
<li>
<a
href="https://vuejs.org"
target="_blank"
>
Core Docs
</a>
</li>
<li>
<a
href="https://forum.vuejs.org"
target="_blank"
>
Forum
</a>
</li>
<li>
<a
href="https://chat.vuejs.org"
target="_blank"
>
Community Chat
</a>
</li>
<li>
<a
href="https://twitter.com/vuejs"
target="_blank"
>
Twitter
</a>
</li>
<br>
<li>
<a
href="http://vuejs-templates.github.io/webpack/"
target="_blank"
>
Docs for This Template
</a>
</li>
</ul>
<h2>Ecosystem</h2>
<ul>
<li>
<a
href="http://router.vuejs.org/"
target="_blank"
>
vue-router
</a>
</li>
<li>
<a
href="http://vuex.vuejs.org/"
target="_blank"
>
vuex
</a>
</li>
<li>
<a
href="http://vue-loader.vuejs.org/"
target="_blank"
>
vue-loader
</a>
</li>
<li>
<a
href="https://github.com/vuejs/awesome-vue"
target="_blank"
>
awesome-vue
</a>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,14 @@
<template>
<div class="navbar">
<van-nav-bar :title="tName" left-text="返回" right-text="按钮" left-arrow />
</div>
</template>
<script>
export default {
props: ['tName']
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,23 @@
<template>
<div class="tabbar">
<van-tabbar v-model="active">
<van-tabbar-item replace to="/" icon="home-o">首页</van-tabbar-item>
<van-tabbar-item replace to="/class" icon="ellipsis">分类</van-tabbar-item>
<van-tabbar-item replace to="/car" icon="shopping-cart-o">购物车</van-tabbar-item>
<van-tabbar-item replace to="/about" icon="friends-o">我的</van-tabbar-item>
</van-tabbar>
</div>
</template>
<script>
export default {
data () {
return {
active: 0
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,22 @@
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'lib-flexible/flexible'
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(Vant)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,18 @@
<template>
<div class="Home">
<h2>我的</h2>
</div>
</template>
<script>
export default {
created () {
// this.$parent.$data.title = '分类'
this.$emit('Title', '我的')
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,23 @@
<template>
<div class="Class">
购物车
</div>
</template>
<script>
export default {
data () {
return {
active: 0
}
},
created () {
// this.$parent.$data.title = '分类'
this.$emit('Title', '购物车')
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,23 @@
<template>
<div class="Class">
分类
</div>
</template>
<script>
export default {
data () {
return {
active: 0
}
},
created () {
// this.$parent.$data.title = '分类'
this.$emit('Title', '分类')
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,78 @@
<template>
<div class="Home">
<van-tabs v-model="active">
<van-tab title="标签 2">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad">
<van-cell v-for="(item,index) in list.items" :key="index" :title="item.title" />
</van-list>
</van-tab>
<van-tab title="标签 2">内容 2</van-tab>
<van-tab title="标签 3">内容 3</van-tab>
<van-tab title="标签 4">内容 4</van-tab>
</van-tabs>
</div>
</template>
<script>
export default {
data () {
return {
active: 0,
list: {
items: [],
current_page: 1,
total_page: 2
},
loading: false,
finished: false
}
},
async created () {
await this.getData()
// this.$parent.$data.title = '分类'
this.$emit('Title', '首页')
},
methods: {
async getData() {
let res = await this.$http.get('http://127.0.0.1:3000/api/index/class', {
params: {
type: 1,
page: this.list.current_page
}
})
this.list.items = [...this.list.items, ...res.data.result.items]
this.list.current_page = res.data.result.current_page
this.list.total_page = res.data.result.total_page
console.log(this.list);
},
onLoad() {
++this.list.current_page;
this.getData();
this.loading = false;
if (this.list.current_page >= 4) {
this.finished = true;
return;
}
console.log("滚动到底部");
}
}
}
</script>
<style scoped>
.Home {
padding-bottom: 50px;
}
</style>

View File

@@ -0,0 +1,29 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Home',
component: () => import(/* webpackChunkName: "home" */ '../page/Home')
},
{
path: '/about',
name: 'About',
component: () => import(/* webpackChunkName: "about" */ '../page/About')
},
{
path: '/class',
name: 'Class',
component: () => import(/* webpackChunkName: "class" */ '../page/Class')
},
{
path: '/car',
name: 'Car',
component: () => import(/* webpackChunkName: "car" */ '../page/Car')
}
]
})

View File

@@ -0,0 +1,16 @@
babel js语法转换工具 es6,7,8 转换为 es5
eslint 代码语法检查工具
postcss 解决css问题的兼容性...
webpack
xhr
vue-source
axios
fetch

View File

@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

View File

@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -0,0 +1,19 @@
# ddd
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
{
"name": "ddd",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "vue-cli-service serve --mode development",
"build": "vue-cli-service build --mode production"
},
"dependencies": {
"axios": "^0.20.0",
"core-js": "^3.6.5",
"vant": "^2.10.6",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"lib-flexible": "^0.3.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"vue-template-compiler": "^2.6.11",
"postcss-pxtorem": "^5.1.1"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,31 @@
<template lang="pug">
#app
#nav
router-link(to="/") Home
router-link(to="/about") About
router-view
</template>
<style lang="less">
@import "~@less/utils/normalize.less";
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>

View File

@@ -0,0 +1,304 @@
@red50: #ffebee;
@red100: #ffcdd2;
@red200: #ef9a9a;
@red300: #e57373;
@red400: #ef5350;
@red500: #f44336;
@red600: #e53935;
@red700: #d32f2f;
@red800: #c62828;
@red900: #b71c1c;
@redA100: #ff8a80;
@redA200: #ff5252;
@redA400: #ff1744;
@redA700: #d50000;
@red: @red500;
@pink50: #fce4ec;
@pink100: #f8bbd0;
@pink200: #f48fb1;
@pink300: #f06292;
@pink400: #ec407a;
@pink500: #e91e63;
@pink600: #d81b60;
@pink700: #c2185b;
@pink800: #ad1457;
@pink900: #880e4f;
@pinkA100: #ff80ab;
@pinkA200: #ff4081;
@pinkA400: #f50057;
@pinkA700: #c51162;
@pink: @pink500;
@purple50: #f3e5f5;
@purple100: #e1bee7;
@purple200: #ce93d8;
@purple300: #ba68c8;
@purple400: #ab47bc;
@purple500: #9c27b0;
@purple600: #8e24aa;
@purple700: #7b1fa2;
@purple800: #6a1b9a;
@purple900: #4a148c;
@purpleA100: #ea80fc;
@purpleA200: #e040fb;
@purpleA400: #d500f9;
@purpleA700: #aa00ff;
@purple: @purple500;
@deepPurple50: #ede7f6;
@deepPurple100: #d1c4e9;
@deepPurple200: #b39ddb;
@deepPurple300: #9575cd;
@deepPurple400: #7e57c2;
@deepPurple500: #673ab7;
@deepPurple600: #5e35b1;
@deepPurple700: #512da8;
@deepPurple800: #4527a0;
@deepPurple900: #311b92;
@deepPurpleA100: #b388ff;
@deepPurpleA200: #7c4dff;
@deepPurpleA400: #651fff;
@deepPurpleA700: #6200ea;
@deepPurple: @deepPurple500;
@indigo50: #e8eaf6;
@indigo100: #c5cae9;
@indigo200: #9fa8da;
@indigo300: #7986cb;
@indigo400: #5c6bc0;
@indigo500: #3f51b5;
@indigo600: #3949ab;
@indigo700: #303f9f;
@indigo800: #283593;
@indigo900: #1a237e;
@indigoA100: #8c9eff;
@indigoA200: #536dfe;
@indigoA400: #3d5afe;
@indigoA700: #304ffe;
@indigo: @indigo500;
@blue50: #e3f2fd;
@blue100: #bbdefb;
@blue200: #90caf9;
@blue300: #64b5f6;
@blue400: #42a5f5;
@blue500: #2196f3;
@blue600: #1e88e5;
@blue700: #1976d2;
@blue800: #1565c0;
@blue900: #0d47a1;
@blueA100: #82b1ff;
@blueA200: #448aff;
@blueA400: #2979ff;
@blueA700: #2962ff;
@blue: @blue500;
@lightBlue50: #e1f5fe;
@lightBlue100: #b3e5fc;
@lightBlue200: #81d4fa;
@lightBlue300: #4fc3f7;
@lightBlue400: #29b6f6;
@lightBlue500: #03a9f4;
@lightBlue600: #039be5;
@lightBlue700: #0288d1;
@lightBlue800: #0277bd;
@lightBlue900: #01579b;
@lightBlueA100: #80d8ff;
@lightBlueA200: #40c4ff;
@lightBlueA400: #00b0ff;
@lightBlueA700: #0091ea;
@lightBlue: @lightBlue500;
@cyan50: #e0f7fa;
@cyan100: #b2ebf2;
@cyan200: #80deea;
@cyan300: #4dd0e1;
@cyan400: #26c6da;
@cyan500: #00bcd4;
@cyan600: #00acc1;
@cyan700: #0097a7;
@cyan800: #00838f;
@cyan900: #006064;
@cyanA100: #84ffff;
@cyanA200: #18ffff;
@cyanA400: #00e5ff;
@cyanA700: #00b8d4;
@cyan: @cyan500;
@teal50: #e0f2f1;
@teal100: #b2dfdb;
@teal200: #80cbc4;
@teal300: #4db6ac;
@teal400: #26a69a;
@teal500: #009688;
@teal600: #00897b;
@teal700: #00796b;
@teal800: #00695c;
@teal900: #004d40;
@tealA100: #a7ffeb;
@tealA200: #64ffda;
@tealA400: #1de9b6;
@tealA700: #00bfa5;
@teal: @teal500;
@green50: #e8f5e9;
@green100: #c8e6c9;
@green200: #a5d6a7;
@green300: #81c784;
@green400: #66bb6a;
@green500: #4caf50;
@green600: #43a047;
@green700: #388e3c;
@green800: #2e7d32;
@green900: #1b5e20;
@greenA100: #b9f6ca;
@greenA200: #69f0ae;
@greenA400: #00e676;
@greenA700: #00c853;
@green: @green500;
@lightGreen50: #f1f8e9;
@lightGreen100: #dcedc8;
@lightGreen200: #c5e1a5;
@lightGreen300: #aed581;
@lightGreen400: #9ccc65;
@lightGreen500: #8bc34a;
@lightGreen600: #7cb342;
@lightGreen700: #689f38;
@lightGreen800: #558b2f;
@lightGreen900: #33691e;
@lightGreenA100: #ccff90;
@lightGreenA200: #b2ff59;
@lightGreenA400: #76ff03;
@lightGreenA700: #64dd17;
@lightGreen: @lightGreen500;
@lime50: #f9fbe7;
@lime100: #f0f4c3;
@lime200: #e6ee9c;
@lime300: #dce775;
@lime400: #d4e157;
@lime500: #cddc39;
@lime600: #c0ca33;
@lime700: #afb42b;
@lime800: #9e9d24;
@lime900: #827717;
@limeA100: #f4ff81;
@limeA200: #eeff41;
@limeA400: #c6ff00;
@limeA700: #aeea00;
@lime: @lime500;
@yellow50: #fffde7;
@yellow100: #fff9c4;
@yellow200: #fff59d;
@yellow300: #fff176;
@yellow400: #ffee58;
@yellow500: #ffeb3b;
@yellow600: #fdd835;
@yellow700: #fbc02d;
@yellow800: #f9a825;
@yellow900: #f57f17;
@yellowA100: #ffff8d;
@yellowA200: #ffff00;
@yellowA400: #ffea00;
@yellowA700: #ffd600;
@yellow: @yellow500;
@amber50: #fff8e1;
@amber100: #ffecb3;
@amber200: #ffe082;
@amber300: #ffd54f;
@amber400: #ffca28;
@amber500: #ffc107;
@amber600: #ffb300;
@amber700: #ffa000;
@amber800: #ff8f00;
@amber900: #ff6f00;
@amberA100: #ffe57f;
@amberA200: #ffd740;
@amberA400: #ffc400;
@amberA700: #ffab00;
@amber: @amber500;
@orange50: #fff3e0;
@orange100: #ffe0b2;
@orange200: #ffcc80;
@orange300: #ffb74d;
@orange400: #ffa726;
@orange500: #ff9800;
@orange600: #fb8c00;
@orange700: #f57c00;
@orange800: #ef6c00;
@orange900: #e65100;
@orangeA100: #ffd180;
@orangeA200: #ffab40;
@orangeA400: #ff9100;
@orangeA700: #ff6d00;
@orange: @orange500;
@deepOrange50: #fbe9e7;
@deepOrange100: #ffccbc;
@deepOrange200: #ffab91;
@deepOrange300: #ff8a65;
@deepOrange400: #ff7043;
@deepOrange500: #ff5722;
@deepOrange600: #f4511e;
@deepOrange700: #e64a19;
@deepOrange800: #d84315;
@deepOrange900: #bf360c;
@deepOrangeA100: #ff9e80;
@deepOrangeA200: #ff6e40;
@deepOrangeA400: #ff3d00;
@deepOrangeA700: #dd2c00;
@deepOrange: @deepOrange500;
@brown50: #efebe9;
@brown100: #d7ccc8;
@brown200: #bcaaa4;
@brown300: #a1887f;
@brown400: #8d6e63;
@brown500: #795548;
@brown600: #6d4c41;
@brown700: #5d4037;
@brown800: #4e342e;
@brown900: #3e2723;
@brown: @brown500;
@blueGrey50: #eceff1;
@blueGrey100: #cfd8dc;
@blueGrey200: #b0bec5;
@blueGrey300: #90a4ae;
@blueGrey400: #78909c;
@blueGrey500: #607d8b;
@blueGrey600: #546e7a;
@blueGrey700: #455a64;
@blueGrey800: #37474f;
@blueGrey900: #263238;
@blueGrey: @blueGrey500;
@grey50: #fafafa;
@grey100: #f5f5f5;
@grey200: #eeeeee;
@grey300: #e0e0e0;
@grey400: #bdbdbd;
@grey500: #9e9e9e;
@grey600: #757575;
@grey700: #616161;
@grey800: #424242;
@grey900: #212121;
@grey: @grey500;
@black: #000000;
@white: #ffffff;
@transparent: rgba(0, 0, 0, 0);
@fullBlack: rgba(0, 0, 0, 1);
@darkBlack: rgba(0, 0, 0, 0.87);
@lightBlack: rgba(0, 0, 0, 0.54);
@minBlack: rgba(0, 0, 0, 0.26);
@faintBlack: rgba(0, 0, 0, 0.12);
@fullWhite: rgba(255, 255, 255, 1);
@darkWhite: rgba(255, 255, 255, 0.87);
@lightWhite: rgba(255, 255, 255, 0.54);

View File

@@ -0,0 +1,43 @@
@import "./index.less";
@fontFamily: Roboto, Lato, sans-serif;
// primary and accent
@primaryColor: @blue; // 主色
@secondaryColor: @pinkA200;
@successColor: @green;
@warningColor: @yellow600;
@errorColor: @red;
@infoColor: @blue;
@trackColor: @grey400;
// textColor or borderColor
@textColor: @darkBlack;
@secondaryTextColor: fade(@fullBlack, 54%);
@alternateTextColor: @white;
@borderColor: fade(@fullBlack, 12%);
@disabledColor: fade(@fullBlack, 38%);
// background
@backgroundColor: @grey50;
@dialogBackgroundColor: @white; // dialogs or cards
@chipBackgroundColor: @grey300;
// icon color
@activeIconColor: fade(@fullBlack, 54%);
@inActiveIconColor: fade(@fullBlack, 38%);
// spaceing
@iconSize: 24px;
@desktopGutter: 24px;
@desktopGutterMore: 32px;
@desktopGutterLess: 16px;
@desktopGutterMini: 8px;
@desktopKeylineIncrement: 64px;
@desktopDropDownMenuItemHeight: 32px;
@desktopDropDownMenuFontSize: 15px;
@desktopDrawerMenuItemHeight: 48px;
@desktopSubheaderHeight: 48px;
@desktopToolbarHeight: 56px;
// animate
@easeOutFunction: cubic-bezier(0.23, 1, 0.32, 1);
@easeInOutFunction: cubic-bezier(0.445, 0.05, 0.55, 0.95);

View File

@@ -0,0 +1,4 @@
@import "../color/var.less";
h2 {
color: @successColor;
}

View File

@@ -0,0 +1,310 @@
.transition(@d) {
-webkit-transition-duration: @d;
transition-duration: @d;
}
.delay(@d) {
-webkit-transition-delay: @d;
transition-delay: @d;
}
.transform(@t) {
-webkit-transform: @t;
transform: @t;
}
.transform-origin(@to) {
-webkit-transform-origin: @to;
transform-origin: @to;
}
.translate3d(@x:0, @y:0, @z:0) {
-webkit-transform: translate3d(@x,@y,@z);
transform: translate3d(@x,@y,@z);
}
.animation (@a) {
-webkit-animation: @a;
animation: @a;
}
.scrollable() {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.flex-shrink(@fs) {
-webkit-box-flex: @fs;
-webkit-flex-shrink: @fs;
-ms-flex: 0 @fs auto;
flex-shrink: @fs;
}
.clearfix() {
&:after,
&:before {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
.hairline(@position, @color) when (@position = top) {
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: auto;
right: auto;
height: 1px;
width: 100%;
background-color: @color;
display: block;
z-index: 15;
// .transform-origin(50% 0%);
html.pixel-ratio-2 & {
.transform(scaleY(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleY(0.33));
}
}
}
.hairline(@position, @color) when (@position = left) {
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: auto;
right: auto;
width: 1px;
height: 100%;
background-color: @color;
display: block;
z-index: 15;
// .transform-origin(0% 50%);
html.pixel-ratio-2 & {
.transform(scaleX(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleX(0.33));
}
}
}
.hairline(@position, @color) when (@position = bottom) {
&:after {
content: '';
position: absolute;
left: 0;
bottom: 0;
right: auto;
top: auto;
height: 1px;
width: 100%;
background-color: @color;
display: block;
z-index: 15;
html.pixel-ratio-2 & {
.transform(scaleY(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleY(0.33));
}
}
}
.hairline(@position, @color) when (@position = right) {
&:after {
content: '';
position: absolute;
right: 0;
top: 0;
left: auto;
bottom: auto;
width: 1px;
height: 100%;
background-color: @color;
display: block;
z-index: 15;
// .transform-origin(100% 50%);
html.pixel-ratio-2 & {
.transform(scaleX(0.5));
}
html.pixel-ratio-3 & {
.transform(scaleX(0.33));
}
}
}
// For right and bottom
.hairline-remove(@position) when not (@position = left) and not (@position = top) {
&:after {
display: none;
}
}
// For left and top
.hairline-remove(@position) when not (@position = right) and not (@position = bottom) {
&:before {
display: none;
}
}
// For right and bottom
.hairline-color(@position, @color) when not (@position = left) and not (@position = top) {
&:after {
background-color: @color;
}
}
// For left and top
.hairline-color(@position, @color) when not (@position = right) and not (@position = bottom) {
&:before {
background-color: @color;
}
}
// Encoded SVG Background
.encoded-svg-background(@svg) {
@url: `encodeURIComponent(@{svg})`;
background-image: url("data:image/svg+xml;charset=utf-8,@{url}");
}
// Preserve3D
.preserve3d() {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
}
// Shadow
.depth(@level:1) {
& when (@level = 0) {
box-shadow: none;
}
& when (@level = 1) {
box-shadow: 0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);
}
& when (@level = 2) {
box-shadow: 0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);
}
& when (@level = 3) {
box-shadow: 0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12);
}
& when (@level = 4) {
box-shadow: 0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);
}
& when (@level = 5) {
box-shadow: 0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12);
}
& when (@level = 6) {
box-shadow: 0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);
}
& when (@level = 7) {
box-shadow: 0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12);
}
& when (@level = 8) {
box-shadow: 0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12);
}
& when (@level = 9) {
box-shadow: 0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12);
}
& when (@level = 10) {
box-shadow: 0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12);
}
& when (@level = 11) {
box-shadow: 0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12);
}
& when (@level = 12) {
box-shadow: 0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12);
}
& when (@level = 13) {
box-shadow: 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12);
}
& when (@level = 14) {
box-shadow: 0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12);
}
& when (@level = 15) {
box-shadow: 0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12);
}
& when (@level = 16) {
box-shadow: 0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12);
}
& when (@level = 17) {
box-shadow: 0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12);
}
& when (@level = 18) {
box-shadow: 0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12);
}
& when (@level = 19) {
box-shadow: 0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12);
}
& when (@level = 20) {
box-shadow: 0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12);
}
& when (@level = 21) {
box-shadow: 0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12);
}
& when (@level = 22) {
box-shadow: 0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12);
}
& when (@level = 23) {
box-shadow: 0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12);
}
& when (@level = 24) {
box-shadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12);
}
// & when (@level = 1) {
// box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
// }
// & when (@level = 2) {
// box-shadow: rgba(0, 0, 0, 0.156863) 0px 3px 10px, rgba(0, 0, 0, 0.227451) 0px 3px 10px;
// }
// & when (@level = 3) {
// box-shadow: rgba(0, 0, 0, 0.188235) 0px 10px 30px, rgba(0, 0, 0, 0.227451) 0px 6px 10px;
// }
// & when (@level = 4) {
// box-shadow: rgba(0, 0, 0, 0.247059) 0px 14px 45px, rgba(0, 0, 0, 0.219608) 0px 10px 18px;
// }
// & when (@level = 5) {
// box-shadow: rgba(0, 0, 0, 0.298039) 0px 19px 60px, rgba(0, 0, 0, 0.219608) 0px 15px 20px;
// }
}
// Highlighted Links
.active-highlight(@color:rgba(255, 255, 255, 0.15)){
&:before {
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-color: @color;
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
opacity: 0;
pointer-events: none;
.transition(600ms);
}
&.active-state:before,
html:not(.watch-active-state) &:active:before {
opacity: 1;
.transition(150ms);
}
}
.active-highlight-color(@color) {
&:before {
background-image: -webkit-radial-gradient(center, circle cover, @color 66%, rgba(red(@color),green(@color),blue(@color),0) 66%);
background-image: radial-gradient(circle at center, @color 66%, rgba(red(@color),green(@color),blue(@color),0) 66%);
}
}
// No Scrollbar
.no-scrollbar() {
&::-webkit-scrollbar {
display: none !important;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
opacity: 0 !important;
}
}
.ellipsis() {
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
word-wrap: break-word;
}

View File

@@ -0,0 +1,419 @@
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in Edge, IE, and Firefox.
* 2. Add the correct display in IE.
*/
article,
aside,
details, /* 1 */
figcaption,
figure,
footer,
header,
main, /* 2 */
menu,
nav,
section,
summary { /* 1 */
display: block;
}
/**
* Add the correct display in IE 9-.
*/
audio,
canvas,
progress,
video {
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Add the correct display in IE 10-.
* 1. Add the correct display in IE.
*/
template, /* 1 */
[hidden] {
display: none;
}
/* Links
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/* Text-level semantics
========================================================================== */
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/* Forms
========================================================================== */
/**
* 1. Change font properties to `inherit` in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
select,
textarea {
font: inherit; /* 1 */
margin: 0; /* 2 */
}
/**
* Restore the font weight unset by the previous rule.
*/
optgroup {
font-weight: bold;
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
* controls in Android 4.
* 2. Correct the inability to style clickable types in iOS and Safari.
*/
button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* 2 */
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10-.
* 2. Remove the padding in IE 10-.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,70 @@
<template lang="pug">
.hello
h1 {{ msg }}
p
| For a guide and recipes on how to configure / customize this project,
br
| check out the
a(href='https://cli.vuejs.org', target='_blank', rel='noopener') vue-cli documentation
| .
h3 Installed CLI Plugins
ul
li
a(href='https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel', target='_blank', rel='noopener') babel
li
a(href='https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router', target='_blank', rel='noopener') router
li
a(href='https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex', target='_blank', rel='noopener') vuex
h3 Essential Links
ul
li
a(href='https://vuejs.org', target='_blank', rel='noopener') Core Docs
li
a(href='https://forum.vuejs.org', target='_blank', rel='noopener') Forum
li
a(href='https://chat.vuejs.org', target='_blank', rel='noopener') Community Chat
li
a(href='https://twitter.com/vuejs', target='_blank', rel='noopener') Twitter
li
a(href='https://news.vuejs.org', target='_blank', rel='noopener') News
h3 Ecosystem
ul
li
a(href='https://router.vuejs.org', target='_blank', rel='noopener') vue-router
li
a(href='https://vuex.vuejs.org', target='_blank', rel='noopener') vuex
li
a(href='https://github.com/vuejs/vue-devtools#vue-devtools', target='_blank', rel='noopener') vue-devtools
li
a(href='https://vue-loader.vuejs.org', target='_blank', rel='noopener') vue-loader
li
a(href='https://github.com/vuejs/awesome-vue', target='_blank', rel='noopener') awesome-vue
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,23 @@
import http from "../service";
import Vant from 'vant';
import 'vant/lib/index.css';
export default {
AjaxConfig: {
// 开发阶段的请求基地址
DevUrl: '/api',
// 测试阶段的请求基地址
TestUrl: '',
// 正式阶段的请求基地址
ProdUrl: 'http://127.0.0.1:3000/api/prod',
UrlList: {
class: 'type'
}
},
NotVuePlugin: [
{ n: '$http', v: http }
],
VuePlugin: [
Vant
]
}

View File

@@ -0,0 +1,87 @@
import axios from "axios";
import Utils from "../utils";
import { Toast, Dialog } from 'vant';
class Axios {
constructor() {
this.requestInterceptors()
this.responseInterceptors()
}
/**
* GET请求
* @param {*} object params
* {
* url: '',
* data: {}
* }
*/
async get(params) {
this.setBaseUrl()
return await axios.get(params.url, {
params: params.data
})
}
/**
* post 请求
*/
async post(params) {
this.setBaseUrl()
return await axios.post(params.url, params.data)
}
setBaseUrl () {
axios.defaults.baseURL = Utils.checkUrl();
}
/**
* 请求拦截器
*/
requestInterceptors() {
axios.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
Toast.loading({
duration: 0,
forbidClick: true,
message: '数据加载中....',
});
return config;
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error);
});
}
/**
* 响应拦截器
* 对响应数据做点什么
*/
responseInterceptors() {
axios.interceptors.response.use(function (response) {
Toast.clear();
switch (response.data.code) {
case '500':
Dialog.alert({
title: '出现错误',
message: `${response.data.code}${response.data.msg}`,
});
// 出现错误,不希望返回数据给前端页面,那么这时候将程序在这里断掉
throw new Error(`${response.data.code}${response.data.msg}`)
break;
case 200:
return response.data.data;
break
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
}
}
export default new Axios();

View File

@@ -0,0 +1,16 @@
import 'lib-flexible/flexible'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Config from './config'
Vue.config.productionTip = false
Config.VuePlugin.forEach(v => Vue.use(v))
Config.NotVuePlugin.forEach(v => Vue.prototype[v.n] = v.v)
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')

View File

@@ -0,0 +1,23 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue')
},
{
path: '/about',
name: 'About',
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
}
]
const router = new VueRouter({
routes
})
export default router

Some files were not shown because too many files have changed in this diff Show More