当前位置:网站首页>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);
边栏推荐
- POJ - 1458 common subsequence (longest common subsequence)
- D构造函数问题
- 977.有序数组的平方
- Many scenic spots are temporarily closed due to the typhoon. The provincial culture and tourism department reminds you to pay attention to safety!
- Keras深度学习实战——基于VGG19模型实现性别分类
- Easyai notes - deep learning
- Wasserstein Slim GAIN with Clipping Penalty(WSGAIN-CP)介绍及代码实现——基于生成对抗网络的缺失数据填补
- What is the experience of maintaining Wanxing open source vector database
- In Linux, MySQL sets the job task to start automatically
- 应广PMC131 SOP16 16pin八位单片机
猜你喜欢
MySQL进阶-事务及索引
515. Find the maximum value in each tree row
From a professional background, I can't get into a small company for interview
Develop a controller that prohibits deleting namespaces
Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found
好玩的免费GM游戏整理汇总
aloam 代码阅读与总结
Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode
应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
体验一下阿里云文字识别OCR
随机推荐
Larvel document reading notes custom authentication login and registration using larvel 8
应广单片机003烧录器自定义封装使用技巧
Wasserstein Slim GAIN with Clipping Penalty(WSGAIN-CP)介绍及代码实现——基于生成对抗网络的缺失数据填补
[how is the network connected] Chapter 4 explores access networks and network operators
PMS132B单片机TWS数码管蓝牙充电仓方案开发
How to download wechat payment certificate (API certificate)
PMS150C应广单片机开发案例
Virtual lab basic experiment tutorial -7 Polarization (2)
Taiwan Feiling fm8pb513b MCU provides MCU program development product design
Atcoder beginer contest 237 VP supplement
Huimang micro IO MCU ft60f010a-urt
Alibaba cloud sub account - Permission Policy - full control permission granted to an account and an OSS bucket
Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8
Outsourcing for five years, abandoned
Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode
开发一个禁止删除namespace的控制器
如何下载微信支付证书(API证书)
Huimang micro IO MCU ft60f011a-rb
Yingguang single chip microcomputer pms150/pmc150/pms150c consumer single chip microcomputer
What should we pay attention to in the development process of Yingguang single chip microcomputer?