当前位置:网站首页>Customize a loading instruction
Customize a loading instruction
2022-07-02 18:02:00 【imkaifan】
loading.vue Components
<template>
<div class="loading-wrapper">
<div class="loading-content">
<p class="title">{
{
title }}</p>
</div>
</div>
</template>
<script>
export default {
data() {
return {
title: ' Loading ...' };
}
};
</script>
<style lang="less" scoped>
.loading-wrapper {
// width: 100%;
// height: 100%;
// background: red;
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
.loading-content {
width: 100%;
text-align: center;
.title {
line-height: 20px;
font-size: 12px;
margin: 0;
}
}
}
</style>
loading.js Instruction core code
import Vue from 'vue';
import MyLoading from './loading.vue';
const myLoading = {
inserted(el, binding) {
console.log(' Custom instruction ', el, binding);
const Loading = Vue.extend(MyLoading);
const loading = new Loading().$mount();
console.log('loading', loading);
el.instance = loading;
if (binding.value) {
append(el);
}
},
update(el, binding) {
if (binding.value !== binding.oldValue) {
binding.value ? append(el) : remove(el);
}
}
};
function append(el) {
console.log(' Custom instruction el', el.instance.$el);
el.appendChild(el.instance.$el);
}
function remove(el) {
el.removeChild(el.instance.$el);
}
export default myLoading;



main.js To register Registration instructions
import myLoading from './view/contact/components/loading.js';
Vue.directive('myLoading', myLoading);
边栏推荐
- Longest non repeating subarray
- Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found
- Explain kubernetes network model in detail
- 977.有序数组的平方
- Intelligent hydropower meter energy consumption monitoring cloud platform
- 应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
- 王者荣耀商城异地多活架构设计
- 应广单片机开发流程需要注意哪些?
- Songhan sn8p2511 sop8 single chip microcomputer can be used for burning, providing single chip microcomputer scheme development and single chip microcomputer decryption
- 原装应广单片机 MCU芯片PMS152 SOP8封装 单片机开发
猜你喜欢

MySQL --- 數據庫的基本操作

好玩的免费GM游戏整理汇总
![[golang | grpc] use grpc to realize simple remote call](/img/93/ae6eba2ba65d6e23bd00f45d04a2ed.png)
[golang | grpc] use grpc to realize simple remote call

EdgeNeXt打出了一套混合拳:集CNN与Transformer于一体的轻量级架构

From a professional background, I can't get into a small company for interview

我的创作纪念日

Mb10m-asemi rectifier bridge mb10m

一日2篇Nature!中科大校友段镶锋团队纳米材料新成果,曾是贝尔比奖章第三位华人得主...

Freemaker+poi realizes dynamic generation and parsing of Excel files

MySQL -- basic operation of database
随机推荐
王者荣耀商城异地多活架构设计
Yingguang single chip microcomputer (MCU popular science)
POJ - 1458 common subsequence (longest common subsequence)
怎么可以省去大量的switch语句,省去switch语句
义隆EM78P153K DIP14单片机 MCU
Pms132b single chip microcomputer TWS digital tube Bluetooth charging chamber program development
Virtual lab basic experiment tutorial -7 Polarization (2)
详解Kubernetes网络模型
Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8
Typescript
Huimang micro IO MCU ft60f010a-urt
基数排序的简单理解
vimium映射键
aloam 代码阅读与总结
体验一下阿里云文字识别OCR
977. Square of ordered array
Turn off the xshell connection server and the running jar package will stop automatically
【Zuul】com.netflix.zuul.exception.ZuulException: Hystrix Readed time out
Embedded ~ introduction
Virtual lab basic experiment tutorial -7 Polarization (1)