vue 远程js 组件加载
Vue用户界面预加载器 (Vue-ui-preloader)
Vue-Ui-Loader is a preloader component made with CSS transistions and animations.
Vue-Ui-Loader是由CSS横断面和动画组成的预加载器组件。
Playground Website. Adjust the settings using the playground options. On the bottom of the page you will find the source code that you can directly use in your project or you can manually change the props.
游乐场网站。 使用游乐场选项调整设置。 在页面底部,您将找到可以直接在项目中使用的源代码,也可以手动更改道具。
安装 (Installation)
# use yarn
yarn add vue-ui-preloader
# use npm
npm install --save vue-ui-preloader
用法 (Usage)
In your main.js
在你的main.js中
import loader from "vue-ui-preloader";
Vue.use(loader);
In your template
在您的模板中
<template>
<loader object="#ff9633" color1="#ffffff" color2="#17fd3d" size="5" speed="2" bg="#343a40" objectbg="#999793" opacity="80" name="circular"></loader>
</template>
note(you can either use the playground website to automatically get all the props set or you can set them manaully using the below prop list. You can also resort to not passing any prop, in this case the preloader will use default settings.)
注意(您可以使用游乐场网站自动获取所有道具,也可以使用以下道具列表手动进行设置。您也可以不传递任何道具,在这种情况下,预载器将使用默认设置。)
通过CDN (Via CDN)
CDN demo link - http://jsfiddle.net/8961cm0s/1/
CDN演示链接-http://jsfiddle.net/8961cm0s/1/
In your index.html
在您的index.html中
<script src="https://unpkg.com/vue-ui-preloader"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/vue-ui-preloader/dist/loader.css">
In your template
在您的模板中
<div id="app">
<loader object="#ff9633" color1="#ffffff" color2="#17fd3d" size="5" speed="2" bg="#343a40" objectbg="#999793" opacity="80" name="circular"></loader>
</div>
In your main.js
在你的main.js中
Vue.use(loader)
new Vue({
el: '#app',
components:{
loader:loader
}
});
道具 (Props)
Name | Type | Default | Description |
---|---|---|---|
name | string | 'spinning' | decides the type of loader |
object | string | '#ff9633' | set the color of the loaders. hex or color |
color1 | string | only for circular | set the color of the circular loader disk1. hex or color |
color2 | string | only for circular | set the color of the circular loader disk2. hex or color |
size | number | 5 | set the size of loader |
bg | string | '#343a40' | set the color of the loader background. hex or color |
objectbg | string | '#999793' | set the color of the loader object background. hex or color |
opacity | number | 80 | set the opacity of background |
speed | number | 2 | animation speed in seconds |
名称 | 类型 | 默认 | 描述 |
---|---|---|---|
名称 | 串 | “旋转” | 决定装载机的类型 |
目的 | 串 | '#ff9633' | 设置装载机的颜色。 十六进制或彩色 |
颜色1 | 串 | 仅用于循环 | 设置圆形加载器磁盘的颜色1。 十六进制或彩色 |
颜色2 | 串 | 仅用于循环 | 设置圆形加载器disk2的颜色。 十六进制或彩色 |
尺寸 | 数 | 5 | 设置装载机的尺寸 |
包 | 串 | '#343a40' | 设置加载程序背景的颜色。 十六进制或彩色 |
对象 | 串 | '#999793' | 设置加载程序对象背景的颜色。 十六进制或彩色 |
不透明 | 数 | 80 | 设置背景的不透明度 |
速度 | 数 | 2 | 动画速度(以秒为单位) |
作者 (Author)
Vinayak sharma Hrishikesh Agarwal
翻译自: https://vuejsexamples.com/pre-loader-components-for-vue-js/
vue 远程js 组件加载