前端Js复习-前后台的搭建-结合Bootstrap和JQuery搭建vue项目
流式布局思想
"""
页面的尺寸改变动态改变页面布局,或是通过父集标签控制多个子标签,这种布局思想就称之为 - 流式布局思想 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项目的更多相关文章
- vue项目搭建和开发流程 vue项目配置ElementUI、jQuery和Bootstrap环境
目录 一.VUE项目的搭建 1. 环境搭建 2. 项目的创建和启动 二. 开发项目 1. 配置vue项目启动功能 2. 开发vue项目 (1)项目文件的作用 (2)vue项目开发流程 (3)vue项目 ...
- 前端 JS/TS 调用 ASP.NET Core gRPC-Web
前言 在上两篇文章中,介绍了ASP.NET Core 中的 gRPC-Web 实现 和 在 Blazor WebAssembly 中使用 gRPC-Web,实现了 Blazor WebAssembly ...
- vue项目配置Mock.js
扯在前面 最近一直在忙跳槽的事情,博客也好久没有更新了,上次更新还是去年,不出意外的话,从今天起继续今年的博客之旅. 今天继续完善我之前的项目架构,从零开始搭建vue移动端项目到上线,有需要的同学可以 ...
- 搭建VUE项目
1.换源由于npm源服务器在国内访问速度较慢,所以一般需要更换源服务器地址npm config set registry https://registry.npm.taobao.org也可以安装cnp ...
- 基于springboot+bootstrap+mysql+redis搭建一套完整的权限架构【六】【引入bootstrap前端框架】
https://blog.csdn.net/linzhefeng89/article/details/78752658 基于springboot+bootstrap+mysql+redis搭建一套完整 ...
- 前端知识复习: JS选中变色
前端知识复习:JS选中变色 上篇文章 :前端知识复习:Html DIV 图文混排(文字放在图片下边) Js选中图片效果 <!DOCTYPE html> <html xmlns=&qu ...
- Vue + Spring Boot从零开始搭建个人网站(一) 之 项目前端Vue.js环境搭建
前言: 最近在考虑搭建个人网站,想了想决定采用前后端分离模式 前端使用Vue,负责接收数据 后端使用Spring Boot,负责提供前端需要的API 就这样开启了我边学习边实践之旅 Vue环境搭建步骤 ...
- VSCode调试Html中的脚本 vscode前端常用插件推荐,搭建JQuery、Vue等开发环境 vsCode 添加浏览器调试和js调试的方法总结 VS Code - Debugger for Chrome调试js
一.背景 使用Visual Studio Code写了一个简单的Html页面,想调试下其中script标签里的javascript代码,网上查了一通,基本都是复制粘贴或者大同小异的文章,就是要安装De ...
- 前端Js框架汇总
概述: 有些日子没有正襟危坐写博客了,互联网飞速发展的时代,技术更新迭代的速度也在加快.看着Java.Js.Swift在各领域心花路放,也是煞是羡慕.寻了寻.net的消息,也是振奋人心,.net co ...
随机推荐
- 考研c语言基础 66++6
1.数据类型 对于基本的数据类型,如整型int,long,...(考研中涉及处理的整数题目,如果没有特别要求用int足够了),字符型char,浮点型float.double...(对于处理小数问题,在 ...
- comparable接口 和 comparator接口的特点与区别
1. Comparator 和 Comparable 相同的地方 他们都是java的一个接口, 并且是用来对自定义的class比较大小的. 什么是自定义class: 如 public class Pe ...
- react-native-tab-view 导航栏切换插件讲解
首先引入插件 yarn add react-native-tab-view 如果用的原生环境要安装另外几个插件 yarn add react-native-reanimated react-nativ ...
- Learning Combinatorial Embedding Networks for Deep Graph Matching(基于图嵌入的深度图匹配)
1. 文献信息 题目: Learning Combinatorial Embedding Networks for Deep Graph Matching(基于图嵌入的深度图匹配) 作者:上海交通大学 ...
- Linux-课后练习(第二章命令)20200217-1
- Java算法练习——无重复字符的最长子串
题目链接 题目描述 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度. 示例 1 输入: "abcabcbb" 输出: 3 解释: 因为无重复字符的最长子串是 &qu ...
- oracle(9) 序列和约束
序列 SEQUENCE 也是数据库对象之一,作用:根据指定的规则生成一些列数字. 序列通常是为某张表的主键提供值使用. 主键:通常每张表都会有主键字段,该字段的值要求非空且唯一, 使用该字段来确定表中 ...
- js 动态添加元素 删除元素逻辑
js 动态添加元素 删除元素逻辑 var obox=document.getElementById("box"); oadd.onclick=function(){ var odi ...
- 记录 TypeError: render() got an unexpected keyword argument 'renderer' 错误
在网上看到MXShop这个项目,适合Python, Django + drf 进阶的,其中遇到 TypeError: render() got an unexpected keyword argume ...
- sync实现windows与nginx主机端文件同步(参考文档)
资源 Rsync官网:http://rsync.samba.org/ 简介 Rsync(remote sync)是类unix系统下的远程(LAN/WAN)数据镜像备份工具.可以实现Linux与linu ...