当前位置:网站首页>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);
边栏推荐
- Freemaker+poi realizes dynamic generation and parsing of Excel files
- Mysql - opérations de base de la base de données
- MySQL --- 數據庫的基本操作
- Embedded ~ introduction
- 原厂原装 应广单片机PMS134方案开发应用案例
- Chapter 15 string localization and message Dictionary (1)
- No such file or directory: ‘/tmp/tmpxxx/tmpxxx. py‘
- 应广单片机(MCU单片机科普)
- 应广单片机开发流程需要注意哪些?
- How to download wechat payment certificate (API certificate)
猜你喜欢
![[nonlinear control theory]8_ Comparison of three robust controllers](/img/a8/03ed363659a0a067c2f1934457c106.png)
[nonlinear control theory]8_ Comparison of three robust controllers

ORA-19838 -- 恢复控制文件到备库

深入理解ThreadLocal

体验一下阿里云文字识别OCR

finally详解

Chapter 15 string localization and message Dictionary (1)

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

Yingguang single chip microcomputer development specification pmc131 with AD chip to detect battery voltage single chip microcomputer sop8/14
![[target tracking] | data set summary](/img/2f/39a56d8cfb1638697735616b5e0412.png)
[target tracking] | data set summary
![[how to connect the network] Chapter 5 explore the server](/img/81/60899d017f5f86a223aa8a11c2e5bf.png)
[how to connect the network] Chapter 5 explore the server
随机推荐
使用Zadig从0到1搭建持续交付平台
【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
台湾飞凌FM8PB513B单片机提供单片机方案开发 产品设计
Outsourcing for five years, abandoned
Yingguang pmc131 SOP16 16pin eight bit MCU
Longest non repeating subarray
应广单片机003烧录器自定义封装使用技巧
In Linux, MySQL sets the job task to start automatically
科班出身,面试小公司都进不去
Explain kubernetes network model in detail
【Golang | gRPC】使用openssl生成证书
好玩的免费GM游戏整理汇总
Atcoder beginer contest 237 VP supplement
Rk1126 platform project summary
Wasserstein slim gain with clipping penalty (wsgain-cp) introduction and code implementation -- missing data filling based on generating countermeasure network
vimium映射鍵
Huimang micro IO MCU ft60f011a-rb
MySQL进阶-事务及索引
Troubleshooting ideas that can solve 80% of faults
Yingguang single chip microcomputer pms150/pmc150/pms150c consumer single chip microcomputer