- 博客(59)
- 收藏
- 关注
原创 Vue3中如何使用this
在v3中,使用setup()来代替了以前data、methods函数等。因为,setup执行是在created之前。所以,没有this。但是又想使用$parent,$refs等方法import { getCurrentInstance, ComponentInternalInstance } from 'vue'setup() { // as ComponetInternalInstance表示类型断言,ts时使用。否则报错,proxy为null const { proxy } =
2021-09-07 16:33:28
11853
2
原创 前端div拖拽移动
1.先明确offsetY clientY, pageY, screenY定义(X方向同理)2.明确鼠标事件总共有7个,移动中会用三个(mousedown、mousemove、mouseup)事件名称 事件发生状态 mousedown 鼠标按下时触发 mousemove 鼠标移动时触发 mouseup 鼠标抬起时触发 click 单击鼠标时触发 dbclick 双击鼠标时触发 mouseenter 鼠标移入到某元素上
2021-08-31 11:01:21
980
原创 vuex的基础和进阶
这两天做项目用到了vuex,正好把他做个总结,便于以后在看。使用方法是mapState,mapGetters,mapActions,mapMutations。前面是基础使用方法,后面是模块化(项目中多会使用)。1.安装npm install vuex --save2.使用在main.js里面import router from './router'new Vue({ el: '#app', router, store, components: { App }, temp.
2021-08-03 15:38:30
174
原创 scope的注意与使用
做项目的时候,使用私有组件时,发现前辈写了2个style,一个带scope,一个不带。今天特意去查了一下。原文链接地址为:http://2ue.github.io/2017/11/15/vue-style-scoped/。 scope是对于私有组件而言,这意味着别人不会搞乱该组件的样式。但衍生了其他组件调用该组件的情况。 代码前提:<template> <div class="form"> <span>...
2021-07-30 13:56:59
893
原创 vue中watch和computed的区别
相同点:都是受data中已存在的值或者prop中父组件传过来的值影响不同点:watch:一个数据影响多个数据computed:一个数据受多个数据影响例子:porps:['teamMessageObj','info']watch: { teamMessageObj(obj) { this.name = obj.name; this.id = obj.id; this.value = obj }, 'info.name':function (oldV.
2021-07-14 10:43:47
122
原创 vue组件之间通信
今天做项目时,用了this.$parent.$parent.$parent.去调用组件,结果被提醒了一下。丢死人了。现在,做个总结吧!1.使用bus(适用于层级超过一层的)假如A组件调用B组件的方法A:this.$on(''name'',data)B:this.$emit("name",e=>{ console.log(e)})2.$emit(子组件调用父组件)父组件:<div ></div>子组件:&l...
2021-07-13 17:58:14
82
原创 element-ui 中notification的引入
Vue.prototype.Notification=Notification;代替Vue.use(notification)使用时:this.Notification.error({title:'自定义位置',message:'右上角弹出的消息'});
2021-07-06 14:51:13
809
原创 html5总结
1.视频(vedio audio都要记得controls)<vedio src="XX" controls="controls" width="" height=""><source src=".mp4" type="vedio/mp4"></source>//多个source 浏览器识别并用第一个<source src=".ogg" type="vedio/ogg"></source></vedio>vedio
2020-07-20 17:26:17
122
原创 js知识总结(选自DOM艺术)
1.js的数据类型(8种):string number boolean null undefined array object symbolstring 中转义字符:例子: var s="i don\'t care";
2020-07-19 21:25:52
137
原创 媒体查询几种方式
前端媒体查询是响应式网站开发的基础下面是媒体查询的几个方式:1.@media only screen and(min-width:400px)2.写在link中<link ref="..." media="only sreen and (min-width:40em)">3.写在style中<style media="only screen and (min-width:49em)"></style>4导入(比2 link更好一点)@.
2020-07-09 17:34:11
1712
原创 前端居中
前端布局居中,在这个基础上实现的(例子都是对的)<divclass="father"><divclass="son"></div></div>1. 利用position,前提是表明长宽例子:.father{position:relative}.son{width:100px;height:100px;position:absolute;left:0;right:0;bottom:0;top:0;margin:auto...
2020-06-29 15:27:16
145
原创 前端页面跳转
页面跳转有很多的方法 ,只说利用js方法1.window.location.href="页面名";特点:不会产生新的页面,有时会跳转不了,添加 window.event.returnValue=false;即可例子:2.window.href
2020-06-27 16:58:38
910
原创 小白面试提出的几个问题
1.问到技术难点时,可以说在做项目时,我遇到了哪些问题,是怎么去解决的。2.问到对某个技术了解多少时,3.技术亮点4.面试是一件很累的事情!!
2020-06-04 14:54:29
338
原创 小程序前端获取openid
wx.request({url: 'https://api.weixin.qq.com/sns/jscode2session',data: {appid: 小程序自己的openid,secret: secret,js_code: 获取的code,grant_type: "authorization_code"},success: function (res) {console.log(res)}})
2020-05-24 17:23:24
490
原创 JSON.parse() 界面出现[object]
当界面出现不要惊慌!!非常正常 遍历还是怎样的操作都可以进行另外不一定非得使用JSON.parse
2020-02-17 20:33:51
773
原创 小程序获得用户头像
利用官方自带的open-datahttps://developers.weixin.qq.com/miniprogram/dev/component/open-data.html例如:<open-data type="userAvatarUrl" class="one"></open-data>
2020-02-04 16:08:32
305
原创 小程序中input中图标点击事件
遇到的问题:input后面的图标点击事件为input的事件解决问题:<view class="top"><input class="resarch" placeholder="输入文章标题" type="text" placeholder-style="font-size:30rpx;color:#000000;" ></input><...
2020-02-03 22:00:55
2462
原创 如何在主界面中获得recyclerview中子件的数据
我是想获得recycler中数据的总和 亲测有效噢噢噢噢在java中定义private ArrayList<Map<String, String>> houseRes = new ArrayList<>();public void getMap(){ sum=0; for (int i = 0; i <recycl...
2019-03-21 10:49:12
519
原创 recyclerview获得网络请求的数据显示不出来的问题
try { jsonArray = new JSONArray( s0); for(int i=0;i< 10;i++){ JSONObject jsonObject=jsonArray.getJSONObject( i ); String ss=jsonObject.getString( "orderNum" ); Stri...
2019-03-13 19:27:02
1096
5
原创 归并排序
#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int N=204800;void merge(int a[],int left,int mid,int right){ int n1=mid-left+1; int n2...
2018-11-30 15:28:26
161
原创 第一次用vector容器
/*设有n个正整数,将他们连接成一排,组成一个最大的多位整数。如:n=3时,3个整数13,312,343,连成的最大整数为34331213。如:n=4时,4个整数7,13,4,246连接成的最大整数为7424613。输入描述:有多组测试样例,每组测试样例包含两行,第一行为一个整数N(N<=100),第二行包含N个数(每个数不超过1000,空格分开)。输出描述:每组数据输出一个表示...
2018-10-28 21:59:19
198
原创 好久没有回来了!!!基础的
1.C++中输入字符串时,是不带空格的,带空格的是用getline(cin,输入的名)2.string的长度用length()3.cout输出若不能换行用<<"";
2018-10-21 23:44:41
111
原创 关于字符串的一个小总结
/*关于字符串的一个小总结*//*1.KMP算法*//*#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;int main(){ char str[100],s[100]; cin>>str; cin>>s; int ...
2018-07-09 10:51:13
116
原创 关于树的一个小总结
/*树*//*注:*s与s[]的区别*s为指针,可以随意改变大小 但是内容不得改变s[]为数组,且不能改变大小 内容可以随意改变*//*(1)遍历*//*#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int Max_Size=100;struct T...
2018-07-09 10:11:48
144
原创 关于图的一个小总结
/*图*//*1.遍历*//*(1).广度优先遍历,利用visit数组以及入栈和出栈*//*#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int Max_Size=100;class TU{private: int vertex; int...
2018-07-02 11:23:22
162
原创 关键路径
/*思路:(len为边的权值)事件最早发生时间:ve[k](ve为点),即求出到达该点最长的路径ve[0]=0;ve[k]=max{ve[k]+len<vj,vk>}事件最迟发生时间:vl[k](vl为点),即从后面求,找到最小的路径vl[n-1]=ve[n-1];vl[k]=min{vl[j]-len<vk,vj>}活动最早开始的时间:ee[i](ee为边),即等于该边的...
2018-06-19 10:51:24
325
原创 Floyd算法
/*思路:首先让dist初始化,i==j时,让他最大。然后dist等于最开始的权值,最后三重循环,让dist值最小。*/#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int Max_Size=100;class Floyd{private: i...
2018-06-19 10:08:41
192
原创 Dijkstra
/*思路:首先找到起始点,然后让dist[i]等于其各点与起始点的权值,然后再找最小权值的边,让dist[点]=0;方便下次不在用它*/#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int Max_Size = 100;class Dijkstra{...
2018-06-12 11:26:33
141
原创 Kruskal
#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int Max_Size=100;struct EdgeType{ int from,to; int weight;};class Node{private: int spot,vert...
2018-06-06 10:33:57
514
原创 图的DFS遍历输出
#include<string.h>#include<iostream>#include<stdlib.h>using namespace std;const int MaxSize=100;//深度优先class Tree{private: int visited[MaxSize]; int data[MaxSize][MaxSize]; i...
2018-06-05 10:55:46
936
原创 Prim算法
#include<iostream>#include<string.h>#include<stdlib.h>using namespace std;const int Max_Size=100;struct ShortEdge{ int adjvex; int lowcost;};class Node{private: int str[Max_...
2018-06-05 10:47:34
387
原创 邻接矩阵变成邻接表
#include <iostream>#include <string.h>#include <stdlib.h>using namespace std;const int MaxSize = 100;struct ArcNode{ int adjvex; ArcNode *next;};struct VertexNode{ int verte...
2018-06-02 20:29:22
2307
原创 邻接表转换成邻接矩阵
#include<string.h>#include<iostream>#include<stdlib.h>using namespace std;const int MaxSize = 100;struct ArcNode{ int data; ArcNode *next;};struct VertexNode{ int vertex; ...
2018-06-02 20:28:27
4771
转载 html知识点
1.table(表格)<table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td&a
2018-05-26 14:06:34
107
原创 已知后序和中序求前序
#include<iostream>#include<string>#include<fstream>using namespace std;const int capacity=100;typedef struct TreeNode{ char data; struct TreeNode *l; struct TreeNode *r;} ;v...
2018-05-22 10:24:04
669
原创 已知前序和中序求后序
#include<iostream>#include<string>#include<fstream>using namespace std;const int capacity=100;typedef struct TreeNode{ char data; struct TreeNode *l; struct TreeNode *r;} ;v...
2018-05-22 10:19:12
176
原创 计算二叉树的深度和叶子节点的个数
#include<iostream>#include<string>#include<fstream>using namespace std;const int capacity=100;typedef struct Node{ char data; struct Node *l; struct Node *r;} TreeNode;class...
2018-05-22 10:10:22
4116
原创 哈夫曼代码及编码
#include<iostream>#include<stdlib.h>#include<string.h>#include<iomanip>//这个头文件是声明一些 “流操作符”的//比较常用的有:setw(int);//设置显示宽度,left//right//设置左右对齐。 setprecision(int);//设置浮点数的精确度。/*或者可以...
2018-05-19 14:53:11
333
转载 html知识点(四)
1.font:12px/24px'微软雅黑';16px:指的是字体为16px24px:指的是行高为24pxFONT: 16px/24px ; 是缩写,后面加字体,css必须的格式2. CSS样式一共3中使用方法——内联式样式表行样式<div style="color:#000;"></div>只能操作1个标签,细节灵活——嵌入式样式表<head><sty...
2018-05-13 17:00:47
378
原创 利用递归的思想做二叉树(遍历操作)
#include<iostream>#include<stdlib.h>#include<string.h>using namespace std;const int capacity=100;typedef struct Node{ char data; struct Node *l; struct Node *r;} TreeNode;cl...
2018-05-07 19:36:53
600
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人