blog station

天下事有难易乎?为之,则难者亦易矣;不为,则易者亦难矣。

1.全局安装 vue-cli

1
$ npm install --global vue-cli

2.创建一个基于 webpack 模板的新项目

1
2
3
4
5
cli2.X快速构建项目:
$ vue init webpack vue-project

cli3.0快速构建项目:
vue create vue-project;
阅读全文 »

vscode来写scss,并且保存时自动生成并更新.css和.min.css文件:安装Easy Sass

自定义vscode分隔符

1
2
3
4
5
6
7
{
// 如下是被vscode认为是分隔符的字符
// 我们在设置中搜索editor.wordSeparators
// 然后根据自己的需要删除不想要的分隔符即可
// 比如删除-,我们就可以双击选中-分割的class类名
"editor.wordSeparators": "`~#!@$%^&*()-=+[{]}\\|;:'\",<>/?."
}

快速打印

阅读全文 »

1.hexo博客文件目录下安装live2D插件,执行下面命令:

bash
1
npm install --save hexo-helper-live2d

2.下载live2D动画模型,下面展示了动画列表

live2d-widget-model-chitose
live2d-widget-model-z16
live2d-widget-model-epsilon2_1
live2d-widget-model-gf
live2d-widget-model-haru/01
live2d-widget-model-haru/02
live2d-widget-model-haruto
live2d-widget-model-hibiki
live2d-widget-model-hijiki
live2d-widget-model-izumi
live2d-widget-model-koharu
live2d-widget-model-miku
live2d-widget-model-ni-j
live2d-widget-model-nico
live2d-widget-model-nietzsche
live2d-widget-model-nipsilon
live2d-widget-model-nito
live2d-widget-model-shizuku
live2d-widget-model-tororo
live2d-widget-model-tsumiki
live2d-widget-model-unitychan
live2d-widget-model-wanko

阅读全文 »

数据监听机制 ES6 Proxy

目前,Vue 的反应系统是使用 Object.defineProperty 的 getter 和 setter。
但是,Vue 3 将使用 ES2015 Proxy 作为其观察者机制。 这消除了以前存在的警告,使速度加倍,并节省了一半的内存开销。
为了继续支持 IE11,Vue 3 将发布一个支持旧观察者机制和新 Proxy 版本的构建。

proxy并不比Object.definProperty更快,Object.definProperty只能监听对象属性的改变,而proxy不止可以监听对象属性的改变,还能监听对象属性的增加和删除

重写vDom

阅读全文 »

2022.11.28目前gittalk已经需要翻墙才能使用了,不翻墙会一直提示netwrok error,作为一个遵纪守法的良好公民,我自然是深恶痛绝偷偷翻墙的这种行为,同时对私连IP搭建VPN并以此盈利的不法分子更是痛心疾首,希望能早日醒悟,苦海无涯,回头是岸,否则悔之晚矣

记录一下hexo博客next主题集成gitalk评论插件的步骤

本文参考https://asdfv1929.github.io/2018/01/20/gitalk/
gitalk:一个基于 Github Issue 和 Preact 开发的评论插件
官网:https://gitalk.github.io/
官方GitHub:https://github.com/gitalk/gitalk/blob/master/readme-cn.md

1.在自己的GitHub中注册一个开放授权的gitalk应用

阅读全文 »

生命周期执行顺序:onLoad > onShow > onReady

禁止下拉

app.json中window下加enablePullDownRefresh:false

摇一摇实现相应操作

阅读全文 »

mask-position: 0px 0px;//设置遮罩层的位置
mask-size: 100%;//设置遮罩层的大小
mask-image:url() //设置遮罩层的图像。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<style>
@keyframes clipRectSpIn {
0% {
clip-path: polygon(50% 20%, 50% 50%, 20% 50%, 50% 50%, 50% 80%, 50% 50%, 80% 50%, 50% 50%);
}
50% {
clip-path: polygon(50% 0%, 0% 0%, 0% 50%, 0% 100%, 50% 100%, 100% 100%, 100% 50%, 100% 0%);
}
100% {
clip-path: polygon(50% 20%, 50% 50%, 20% 50%, 50% 50%, 50% 80%, 50% 50%, 80% 50%, 50% 50%);
}
}
.box{
width: 650px;
height: 392px;
position:relative;
}
.mask {
width: 100%;
height: 100%;
background:url("http://www.guoxh.com/blog/img/blog/halibote2.webp") no-repeat left top;
background-size: cover;
position: absolute;
left: 0;
top: 0;
}
.bg{
width: 100%;
height: 100%;
-webkit-mask: url("http://www.guoxh.com/blog/img/blog/halibote1.jpeg");
-webkit-mask-size: 3000% 100%;
animation: maskMove 2s steps(29) infinite;
position: absolute;
left: 0;
top: 0;
}
.mask::before{
content:"";
display:block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url("http://www.guoxh.com/blog/img/blog/halibote1.jpeg") no-repeat left top;
background-size: cover;
animation: clipRectSpIn 6s infinite;
}
/* 这是分割线 */
/* VS效果 */
.mask2{
width:650px;
height:270px;
position:relative;
background:url("http://www.guoxh.com/blog/img/blog/halibote4.webp") no-repeat;
background-size:100% 100%;
background-position:150px;
margin-top:30px;
}
.mask2::before{
content:"";
display:block;
width:650px;
height:270px;
position:absolute;
top: 0;left: 0; right: 0;bottom: 0;
background: url("http://www.guoxh.com/blog/img/blog/halibote5.png");
background-position:-180px;
-webkit-mask: linear-gradient(45deg, #000 45%, transparent 55%);
}
</style>

<body>
<div class="box">
<div class="mask"></div>
<!-- <div class="bg"></div> -->
</div>

<div class="mask2"></div>
</body>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<canvas id="canvas" style="position:fixed;top:0;left:0;width:100%;height:100%;background:#000;" width="1920" height="1080"></canvas>
<script>
window.requestAnimFrame = (function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
var can = document.getElementById('canvas');
var cxt = can.getContext('2d');
can.width = window.screen.width;
can.height = window.screen.height;
var size = 15;
var cols = can.width / size;
var y = [];
for (var i = 0; i < cols; i++)y[i] = 0;
(function draw() {
cxt.fillStyle = 'rgba(0,0,0,.1)';
cxt.fillRect(0, 0, can.width, can.height);
cxt.fillStyle = '#27ff00';
cxt.font = 'bold ' + size + 'px Microsoft yahei';
for (var i = 0; i < cols; i++)
{
var s = Math.floor(Math.random() * 10) + '';
var textX = i * size;
var textY = y[i];
cxt.fillText(s, textX, textY);
y[i] += size;
if (y[i] >= can.height && Math.random() >= 0.9) {
y[i] = 0;
};
}
requestAnimFrame(draw);
})()
</script>

vue-router

组件使用

1
<router-link v-if="!item.isSubmit" :to="'claimOrder?orderNo='+item.orderno+'&caroid='+$route.query.caroid+'&id='+item.id+'&Ins='+$route.query.Ins" class="btn">继续上传</router-link>

组件比起写死的 <a href="..."></a>会好一些,理由如下:
1.无论是 HTML5 history 模式还是 hash 模式,它的表现行为一致,所以,当你要切换路由模式,或者在 IE9 降级使用 hash 模式,无须作任何变动。
2.在 HTML5 history 模式下,router-link 会守卫点击事件,让浏览器不再重新加载页面。
3.当你在 HTML5 history 模式下使用 base 选项之后,所有的 to 属性都不需要写(基路径)了。

阅读全文 »

vuex中Action和mutation的区别

Action 提交的是 mutation,而不是直接变更状态。
Action 可以包含任意异步操作。

vuex使用注意

1.路由组件之间跳转不会刷新vuex中mutation的值,就是说,vuex会保存上次存储过的值,所以要在每次路由跳转到指定页面时,给vuex中的值初始化一次,保证不会把上次的记录的值带过来(待定验证)
2.可以直接把从vuex中取的数据传给后台,不会把vue自定义的东西带过去;

阅读全文 »
0%