12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import baseComponent from '../helpers/baseComponent'
- import classNames from '../helpers/classNames'
- baseComponent({
- properties: {
- prefixCls: {
- type: String,
- value: 'wux-spin',
- },
- classNames: {
- type: null,
- value: 'wux-animate--fadeIn',
- },
- tip: {
- type: String,
- value: '',
- },
- size: {
- type: String,
- value: 'default',
- },
- spinning: {
- type: Boolean,
- value: true,
- observer: 'updated',
- },
- nested: {
- type: Boolean,
- value: false,
- },
- },
- data: {
- spinVisible: true,
- },
- computed: {
- classes() {
- const { prefixCls, size, nested, tip: showText, spinVisible } = this.data
- const wrap = classNames(prefixCls, {
- [`${prefixCls}--${size}`]: size,
- [`${prefixCls}--nested`]: nested,
- [`${prefixCls}--show-text`]: showText,
- })
- const anim = !nested ? `${prefixCls}__spinning` : `${prefixCls}__spinning--nested`
- const dots = `${prefixCls}__dots`
- const dot = `${prefixCls}__dot`
- const tip = `${prefixCls}__tip`
- const container = classNames(`${prefixCls}__container`, {
- [`${prefixCls}__container--blur`]: spinVisible,
- })
- return {
- wrap,
- anim,
- dots,
- dot,
- tip,
- container,
- }
- },
- },
- methods: {
- updated(spinVisible) {
- if (this.data.nested) {
- this.setData({
- spinVisible,
- })
- }
- },
- },
- })
|