\r\n\r\n\t\tTo add a loading within a container, call the $vs.loading()
global function passing the container
and the scale
parameters. When you want to remove it we have $vs.loading.close()
, passing the same container
parameter
\r\n\r\n\t\t\r\n\t\t\tFor the examples, the request or the delay is simulated with setTimeout
\r\n\t\t\r\n\r\n\t\t\r\n\r\n\t\t\t
\r\n\t\t\t\tButton with Loading\r\n\t\t\t\r\n\t\t\t
Div with Loading\r\n\r\n\t\t\t
\r\n\t\t\t\t
Load Me!
\r\n\t\t\t
\r\n\t\t
\r\n\r\n\t\t\r\n<template>\r\n <vs-button ref="loadableButton" id="button-with-loading" class="vs-con-loading__container" @click="openLoadingContained" type="relief" vslor="primary">\r\n Button with Loading\r\n </vs-button>\r\n <vs-button @click="openLoadingInDiv" type="relief" vslor="primary">Div with Loading</vs-button>\r\n\r\n <div class="contained-example-container">\r\n <div id="div-with-loading" class="vs-con-loading__container">Load Me!</div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n data(){\r\n return {\r\n backgroundLoading:'primary',\r\n colorLoading:'#fff',\r\n }\r\n },\r\n methods:{\r\n openLoadingContained(){\r\n this.$vs.loading({\r\n background: this.backgroundLoading,\r\n color: this.colorLoading,\r\n container: "#button-with-loading",\r\n scale: 0.45\r\n })\r\n setTimeout( ()=> {\r\n this.$vs.loading.close("#button-with-loading > .con-vs-loading")\r\n }, 3000);\r\n },\r\n openLoadingInDiv(){\r\n this.$vs.loading({\r\n container: '#div-with-loading',\r\n scale: 0.6\r\n })\r\n setTimeout( ()=> {\r\n this.$vs.loading.close('#div-with-loading > .con-vs-loading')\r\n }, 3000);\r\n },\r\n }\r\n}\r\n</script>\r\n\t\t\r\n\r\n\t\r\n