流式布局思想

"""
页面的尺寸改变动态改变页面布局,或是通过父集标签控制多个子标签,这种布局思想就称之为 - 流式布局思想 1) 将标签宽高设置成 百分比,就可以随屏幕(父集)缩放而缩放
2) 将标签宽高设置成 视图百分比,就可以随屏幕缩放而缩放
3) 将子集字体设置成 继承值,就可以通过父集统一控制子集 """

例子:

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>流式布局</title>
<style>
/*body { margin: 0 }*/
.box {
width: 800px;
height: 200px;
background-color: orange;
/*页面宽度缩放,盒子始终居中*/
margin-left: auto;
margin-right: auto;
width: 80%;
/*vw: view width | vh: view height*/
width: 80vw;
width: 80vh;
}
/*em、rem*/
.sup {
font-size: 40px;
}
.sub {
/*font-size: inherit;*/
/*font-size: 1.5em;*/
/*width: 5em;*/
font-size: 2rem;
}
html {
font-size: 30px;
}
</style>
</head>
<body>
<div class="box"></div>
<div class="sup">
<div class="sub">字</div>
</div>
</body>
</html>

JavaScript函数

简单的举例:

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>js函数</title>
</head>
<body>
<h1>js函数</h1>
</body>
<script>
// 参数:你传你的,我收我的
function fn1(a, b, c, d) {
console.log(a, b, c, d);
console.log('fn1 run');
}
fn1(1, 2, 3); let fn2 = function (...args) {
console.log(args);
console.log(args[0]);
console.log('fn2 run');
};
fn2(1, 2, 3, 4); (function () {
console.log('fn3 run');
})(); let fn4 = () => {
console.log('fn4 run');
};
fn4(); // 有参有反
let fn5 = (a, b) => {
console.log(a, b);
return a + b;
};
let res = fn5(1, 2);
console.log(res); // 箭头函数函数体如果只有返回值,可以简写
let fn6 = (a, b) => a + b;
res = fn6(10, 20);
console.log(res); // 当形参只有一个,可以省略()
let fn7 = a => a * ;
res = fn7(10);
console.log(res); // 当形参为空的简写方式
let fn8 = () => 200;
res = fn8();
console.log(res); </script>
</html>

面向对象JavaScript

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>面向对象js</title>
</head>
<body>
<h1>面向对象js</h1>
</body>
<script>
// ES6
class Student {
constructor(name) {
console.log('构造器调用了');
this.name = name;
} study() {
console.log(`${this.name}在学习`)
}
}
let s1 = new Student('Bob');
console.log(s1.name);
s1.study();
//ES5
function Teacher(name) {
this.name = name;
this.teach = function () {
console.log(`${this.name}在教学`)
};
this.test = () => {
console.log(`${this.name}-test`)
}
}
let t1 = new Teacher('Tom');
console.log(t1.name);
t1.teach();
t1.test(); // 可以理解为类属性,所有对象共有
Teacher.prototype.age = 10;
Teacher.prototype.sleep = function () {
console.log(`${this.name}在睡觉`)
};
console.log(t1.age);
t1.sleep();
let t2 = new Teacher('Jerry');
console.log(t2.age);
t2.sleep(); /* 根组件、局部组件、全局组件都是Vue的对象,所以给Vue原型设置的变量,所有组件的this都可以访问该变量
Vue.prototype.abc = 123;
let localTag = {};
Vue.component('',{});
new Vue({
components: {
localTag
}
});
*/
// function 与 箭头函数 是有本质区别的
let h1 = document.querySelector('h1');
// h1.onclick = function () {
// // alert(this.innerText);
// console.log(this);
// };
// h1.onclick = () => {
// // alert(this.innerText);
// console.log(this);
// }
</script>
</html>

前端Js复习-前后台的搭建-结合Bootstrap和JQuery搭建vue项目的更多相关文章

  1. vue项目搭建和开发流程 vue项目配置ElementUI、jQuery和Bootstrap环境

    目录 一.VUE项目的搭建 1. 环境搭建 2. 项目的创建和启动 二. 开发项目 1. 配置vue项目启动功能 2. 开发vue项目 (1)项目文件的作用 (2)vue项目开发流程 (3)vue项目 ...

  2. 前端 JS/TS 调用 ASP.NET Core gRPC-Web

    前言 在上两篇文章中,介绍了ASP.NET Core 中的 gRPC-Web 实现 和 在 Blazor WebAssembly 中使用 gRPC-Web,实现了 Blazor WebAssembly ...

  3. vue项目配置Mock.js

    扯在前面 最近一直在忙跳槽的事情,博客也好久没有更新了,上次更新还是去年,不出意外的话,从今天起继续今年的博客之旅. 今天继续完善我之前的项目架构,从零开始搭建vue移动端项目到上线,有需要的同学可以 ...

  4. 搭建VUE项目

    1.换源由于npm源服务器在国内访问速度较慢,所以一般需要更换源服务器地址npm config set registry https://registry.npm.taobao.org也可以安装cnp ...

  5. 基于springboot+bootstrap+mysql+redis搭建一套完整的权限架构【六】【引入bootstrap前端框架】

    https://blog.csdn.net/linzhefeng89/article/details/78752658 基于springboot+bootstrap+mysql+redis搭建一套完整 ...

  6. 前端知识复习: JS选中变色

    前端知识复习:JS选中变色 上篇文章 :前端知识复习:Html DIV 图文混排(文字放在图片下边) Js选中图片效果 <!DOCTYPE html> <html xmlns=&qu ...

  7. Vue + Spring Boot从零开始搭建个人网站(一) 之 项目前端Vue.js环境搭建

    前言: 最近在考虑搭建个人网站,想了想决定采用前后端分离模式 前端使用Vue,负责接收数据 后端使用Spring Boot,负责提供前端需要的API 就这样开启了我边学习边实践之旅 Vue环境搭建步骤 ...

  8. VSCode调试Html中的脚本 vscode前端常用插件推荐,搭建JQuery、Vue等开发环境 vsCode 添加浏览器调试和js调试的方法总结 VS Code - Debugger for Chrome调试js

    一.背景 使用Visual Studio Code写了一个简单的Html页面,想调试下其中script标签里的javascript代码,网上查了一通,基本都是复制粘贴或者大同小异的文章,就是要安装De ...

  9. 前端Js框架汇总

    概述: 有些日子没有正襟危坐写博客了,互联网飞速发展的时代,技术更新迭代的速度也在加快.看着Java.Js.Swift在各领域心花路放,也是煞是羡慕.寻了寻.net的消息,也是振奋人心,.net co ...

随机推荐

  1. python阴阳鱼绘制(使用turtle)

    from turtle import * def draw(radius ,color1 , color2): #设置画笔的大小 width(3) #设置画笔颜色和填充颜色 color("b ...

  2. JS高级学习笔记(6)- 事件循环

    参考文章:深入理解JS引擎的执行机制        JavaScript 异步.栈.事件循环.任务队列 我的笔记:ES系列之Promise async 和 await Event Loop 前提 js ...

  3. Unity3d中渲染到RenderTexture的原理,几种方式以及一些问题

    超级搬运工 http://blog.csdn.net/leonwei/article/details/54972653 ---------------------------------------- ...

  4. POJ 1942:Paths on a Grid

    Paths on a Grid Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 22918   Accepted: 5651 ...

  5. Python String startswith() Method

    一,摘自官方API  https://docs.python.org/3/library/stdtypes.html#methods str.startswith(prefix[, start[, e ...

  6. 在linux上部署多个tomcat

    1.vim  /etc/profile ##########first tomcat########### CATALINA_BASE=/usr/apache-tomcat--fore CATALIN ...

  7. winform屏蔽鼠标右键

    /// <summary> /// 屏蔽右键 /// </summary> internal class MenuHandler : IContextMenuHandler { ...

  8. String StringBuffer和StringBuilder的区别和联系

    1:String,StringBuffer和StringBuilder概念 1.1:String String中使用字符串数组来存储字符串,但是是fianl来修饰的,所以String的内容不可改变. ...

  9. Centos7下yum安装软件报错解决办法

    Traceback (most recent call last): File "/usr/bin/yum", line 29, in yummain.user_main(sys. ...

  10. SQL基础教程(第2版)第7章 集合运算:7-1 表的加减法

    第7章 集合运算:7-1 表的加减法 ● 集合运算就是对满足同一规则的记录进行的加减等四则运算.● 使用UNION(并集). INTERSECT(交集). EXCEPT(差集)等集合运算符来进行集合运 ...