123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- const loadingIcon = '../../image/loading.gif'
- Component({
- properties: {
- playType: {
- type: String,
- value: 'wait',
- observer: function(newVal, oldVal){
- if(oldVal == 'loading' && newVal == 'playing') {
- let loadingTransitionTime = 1240;
- let nowTime = + new Date()
- let loadingStartTime = this.data.loadingStartTime
- let loadingTime = nowTime - loadingStartTime
- let loadingCount = parseInt(loadingTime / loadingTransitionTime);
- let timeLeft = loadingTransitionTime - loadingTime % loadingTransitionTime;
- if(loadingCount > 0 && timeLeft > 1000) {
- this.setData({
- realPlayType: newVal,
- loadingImg: '',
- })
- } else {
- setTimeout( ()=>{
- this.setData({
- realPlayType: newVal,
- })
- }, timeLeft)
- }
- } else if (newVal == 'loading'){
- this.setData({
- loadingStartTime: + new Date(),
- realPlayType: newVal,
- })
- } else {
- this.setData({
- realPlayType: newVal,
- })
- }
- },
- }
- },
- data: {
- realPlayType: 'wait',
- loadingStartTime: 0,
- },
- ready: function () {
- },
-
- detached: function() {
- },
- methods: {
- }
- });
|