当前位置:网站首页>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);
边栏推荐
- [target tracking] | data set summary
- Problems needing attention in the development and debugging of Yingguang single chip microcomputer
- Calculation of favorable comment rate
- Pfc232-sop8/14/16 should be wide-ranging and can be tape programmed with burning program
- 阿里云子账户 - 权限策略 - 授权给某个账户某个 OSS Bucket 的完全控制权限
- 科班出身,面试小公司都进不去
- wps插入图片后使图片完整显示
- Android cycle timer implementation, to achieve fixed Android cache cleaning
- Ora-19838 -- restore control files to the standby database
- JDBC
猜你喜欢

515. 在每个树行中找最大值

【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now

515. Find the maximum value in each tree row

使用Zadig从0到1搭建持续交付平台

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

Use Zadig to build a continuous delivery platform from 0 to 1

aloam 代码阅读与总结

Develop a controller that prohibits deleting namespaces

finally详解

Modbus protocol communication exception
随机推荐
[target tracking] | data set summary
自定义一个loading指令
松翰SN8P2511 SOP8单片机 可代烧录 提供单片机方案开发 单片机解密
Mb10m-asemi rectifier bridge mb10m
Experience Alibaba cloud character recognition OCR
The price is only 40 yuan. Pico development board of raspberry pie is added with WiFi module, and it is out of stock as soon as it comes into the market
Troubleshooting ideas that can solve 80% of faults
王者荣耀商城异地多活架构设计
aloam 代码阅读与总结
详解Kubernetes网络模型
From a professional background, I can't get into a small company for interview
[golang | grpc] generate certificates using OpenSSL
Simple understanding of cardinality sorting
[how is the network connected] Chapter 4 explores access networks and network operators
D构造函数问题
How to download wechat payment certificate (API certificate)
MB10M-ASEMI整流桥MB10M
uva1169
原厂原装 应广单片机PMS134方案开发应用案例
我的创作纪念日