Comments (11)
Thanks.
Ps: i just saw first question of yours I'll answer it now,
I need loading on pages without request because if you put url directly axious doesn't have any caches so it take time to page be loaded even static pages so i needed loading for that matter.
from vue-element-loading.
You must declare reactive data (isActive
) like this.
<template>
<div>
<vue-element-loading :active="isActive" :is-full-screen="true"/>
<a @click="isActive = true"> Start Loading </a>
</div>
</template>
<script>
import VueElementLoading from 'vue-element-loading';
export default {
data() {
return {
isActive: false,
app_name: process.env.MIX_APP_NAME,
}
},
components: {
VueElementLoading
}
}
</script>
You can see detail in this link.
And you can select type of spinner with attribute spinner
<vue-element-loading :active="isActive" :is-full-screen="true" spinner="bar-fade-scale"/>
See more spinner type in #Spinner
from vue-element-loading.
Thank you, I'll try that and will close this issue if it works <3.
from vue-element-loading.
@biigpongsatorn hi man,
I've tried your code (without button cause in real app i don't apply button for loading spinner)
in case of isActive: false,
it won't load, in case of isActive: true;
and isActive: '';
it will not disappear after page is loaded.
what should I do now?
from vue-element-loading.
You should change data of isActive
when you want to show loading you should set this.isActive = true
and when your progress success you want to hide loading you should set this.isActive = false
Example
<template>
<div>
<vue-element-loading :active="isActive" :is-full-screen="true"/>
</div>
</template>
<script>
import VueElementLoading from 'vue-element-loading';
export default {
data() {
return {
isActive: false,
app_name: process.env.MIX_APP_NAME,
}
},
methods: {
getSomeData () {
this.isActive = true
// Your code...
this.isActive = false
}
},
components: {
VueElementLoading
}
}
</script>
from vue-element-loading.
@biigpongsatorn the thing is my page is all about static data and nothing dynamic (there is no methods) is just bunch of html codes as my mainpage
or login page
for instance is just a form and method will work after user is sending request, so basically i need to render this when page loads and not when axios retrieving data.
from vue-element-loading.
@robertnicjoo Can you show your code ?
from vue-element-loading.
@biigpongsatorn here you go:
<template>
<div>
<vue-element-loading :active="isActive" :is-full-screen="true" spinner="bar-fade-scale"/>
<navbar></navbar>
<div class="jumbotron jumbotron-fluid text-center">
<div class="container">
<h1 class="display-4 mmb-5">Welcome to App</h1>
<form>
<div class="form-row justify-content-center align-items-center mmt-5">
<div class="col-md-4">
<label class="sr-only" for="inlineFormInput">Query</label>
<input type="text" class="customformdes form-control mb-2" id="inlineFormInput" placeholder="E.g. Larave, Vue, Design, Writer">
</div>
<div class="col-md-4">
<label class="sr-only" for="inlineFormInputGroup">Area</label>
<input type="text" class="customformdes form-control mb-2" id="inlineFormInputGroup" placeholder="E.g. Jabodetabek, Medan, Surabaya">
</div>
<div class="col-md-2">
<button type="button" class="customformdes btn btn-block btn-primary mb-2">Search</button>
</div>
</div>
</form>
</div>
</div>
<div class="container-fluid counters">
<div class="row text-center">
<div class="col-md-3">
<p>Projects</p>
<div class="iCountUp">
<ICountUp
:startVal="first.startVal"
:endVal="first.endVal"
:decimals="first.decimals"
:duration="first.duration"
:options="first.options"
@ready="onFirst"
/>
</div>
</div>
<div class="col-md-3">
<p>Users</p>
<div class="iCountUp">
<ICountUp
:startVal="sec.startVal"
:endVal="sec.endVal"
:decimals="sec.decimals"
:duration="sec.duration"
:options="sec.options"
@ready="onSec"
/>
</div>
</div>
<div class="col-md-3">
<p>Projects proceed</p>
<div class="iCountUp">
<ICountUp
:startVal="third.startVal"
:endVal="third.endVal"
:decimals="third.decimals"
:duration="third.duration"
:options="third.options"
@ready="onThird"
/>
</div>
</div>
<div class="col-md-3">
<p>Daily paid</p>
<div class="iCountUp">
<ICountUp
:startVal="fourth.startVal"
:endVal="fourth.endVal"
:decimals="fourth.decimals"
:duration="fourth.duration"
:options="fourth.options"
@ready="onFourth"
/>
</div>
</div>
</div>
</div>
<footerss></footerss>
</div>
</template>
<script>
import navbar from './navbar.vue';
import footerss from './footer.vue';
import ICountUp from 'vue-countup-v2';
import VueElementLoading from 'vue-element-loading';
export default {
data() {
return {
isActive: false,
first: {
startVal: 0,
endVal: 120500,
decimals: 0,
duration: 2,
options: {
useEasing: true,
useGrouping: true,
separator: ',',
decimal: '.',
prefix: '',
suffix: ''
}
},
sec: {
startVal: 0,
endVal: 5000,
decimals: 0,
duration: 2,
options: {
useEasing: true,
useGrouping: true,
separator: ',',
decimal: '.',
prefix: '',
suffix: ''
}
},
third: {
startVal: 0,
endVal: 58000,
decimals: 0,
duration: 2,
options: {
useEasing: true,
useGrouping: true,
separator: ',',
decimal: '.',
prefix: '',
suffix: ''
}
},
fourth: {
startVal: 0,
endVal: 135000000,
decimals: 0,
duration: 2,
options: {
useEasing: true,
useGrouping: true,
separator: ',',
decimal: '.',
prefix: 'Rp. ',
suffix: ''
}
}
};
},
components: {
navbar,
footerss,
ICountUp,
VueElementLoading
},
//my methods are basically static numbers (counter) nothing comes from server
methods: {
onFirst: function(instance, CountUp) {
const that = this.first;
instance.update(that.endVal);
},
onSec: function(instance, CountUp){
const that = this.sec;
instance.update(that.endVal);
},
onThird: function(instance, CountUp){
const that = this.third;
instance.update(that.endVal);
},
onFourth: function(instance, CountUp){
const that = this.fourth;
instance.update(that.endVal);
}
}
}
</script>
from vue-element-loading.
@robertnicjoo Actualy you can set default isActive = true
and when element rendered you change value of isActive = false
like this. But maybe loading will show and hide very fast. So if you want to show loading longer time you can use setTimeout
for delay time.
<template>
<div>
<vue-element-loading :active="isActive" :is-full-screen="true"/>
</div>
</template>
<script>
import VueElementLoading from 'vue-element-loading';
export default {
data() {
return {
isActive: true,
app_name: process.env.MIX_APP_NAME,
}
},
mounted () {
this.isActive = false
},
components: {
VueElementLoading
}
}
</script>
from vue-element-loading.
@biigpongsatorn unfortunately that doesn't work.
from vue-element-loading.
@robertnicjoo I think maybe this plugin can help you.
https://github.com/hilongjw/vue-lazyload
from vue-element-loading.
Related Issues (20)
- It would be great if we can pass text with loading also ? :) HOT 1
- Invalid default value for prop testStyle HOT 8
- use typescript in this library ? HOT 1
- Minified version was not updated ! HOT 3
- Not working in IE 11 - getting Script Syntax error HOT 12
- 不兼容Android低版本 HOT 3
- Size is not taking effect HOT 3
- Set default config HOT 5
- Arrow function not transpiled in vue-element-loading.min.js HOT 3
- Old Versions
- [Feature request] Loader delay HOT 5
- compatibility with Vue 3? HOT 12
- IE11 compatibility issue (sintax error)
- fully featured live demo is down HOT 1
- npm version 2.0.1 is latest now not working on vue 2 HOT 2
- Can we have esm build for cdn usage ?
- SSR ReferenceError: document is not defined HOT 7
- Functions HOT 1
- Bootstrap modal z-index HOT 2
- change Background Color HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-element-loading.