Home > Mobile >  WeChat applet, compatibility problem?
WeChat applet, compatibility problem?

Time:10-16

Use WeChat small program wrote a similar to eliminate the small program, finished now, in the debug, appeared problem,
On the platform by clicking on the event changes in the name of the class, WXNL

WXML: & lt; The view wx: for="{{wordMsg}}" wx: key="index" class="align 'data - the index=' {{index}} 'catchtap=" {{item. The flag? 'gameda' : ' '}} "& gt;




Data: data: {
Index: [{
Ind: '0'
}, {
Di: '0'
},
WordMsg: [{
Word1: "Gas \ r \ n Station",
The classname: 'text - bg,
Pipei: '1',
Textfonname: 'text - fon,
Flag: true
},
{
Word1: "gas station",
The classname: 'text - bg,
Pipei: '1',
Textfonname: 'text - fon,
Flag: true
},
Event code: gameda: function (e) {
The console. The log (' click event trigger ')
//click on the modify button state
var that=this;
Var g1=parseInt (e.c. with our fabrication: urrentTarget. Dataset. The index)
Var wordMsg=that. Data. WordMsg
//change the selected
If (wordMsg [g1] classname=='text - bg') {
WordMsg [g1] classname='text - bg1';
} else {
WordMsg [g1] classname='text - bg';
}
That the setData ({
WordMsg: wordMsg
})
//judgment logic start

Var index=that. Data. The index
Var I=index [1]. Di
+ + I
The index [1]. Di=I
//the console. The log (I)
Wx. SetStorage ({
Key: 'dianji',
Data: the index [1]. Di,
})
//the console. The log (wx. GetStorageSync (' dianji))
Var DJCS=wx. GetStorageSync (' dianji)
//clicks validation print
//the console. The log (DJCS)
//record button click
Var index_1
Var index_2
If ((DJCS % 2)==1) {
Wx. SetStorage ({
Key: 'index_1',
Data: parseInt (e.c. with our fabrication: urrentTarget. Dataset. The index),
})
Wx. SetStorage ({
Key: 'pipeima_1',
Data: wordMsg [g1] pipei,
})
//the console. The log (' single into ')
} else {
Wx. SetStorage ({
Key: 'index_2',
Data: parseInt (e.c. with our fabrication: urrentTarget. Dataset. The index),
})
Wx. SetStorage ({
Key: 'pipeima_2',
Data: wordMsg [g1] pipei,
})
//the console. The log (' double into ')
}
If ((DJCS % 2)!=0) {
//the console. The log (' judgment two single into ')
//the console. The log (' judgment two single into do not change)
} else {
Var value_3=wx. GetStorageSync (' pipeima_1 ')//button to match the code for the first time
The console. The log (' button for the first time matching code: + value_3)
Var value_4=wx. GetStorageSync (' pipeima_2 ')//on the matching of the second button code
The console. The log (' matching code: the second button + value_4)
.//the console log (' judgment two double into ')
Value_3=parseInt (value_3)
Value_4=parseInt (value_4)
Var value_5=value_3 + value_4
Two matching code and the console. The log (' : '+ value_5)
If (value_5==0) {
The console. The log (' judgment entered into ')
Var value_1=wx. GetStorageSync (' index_1 ')//get the first button index
//the console. The log (+ value_1 button index for the first time:)
Var value_2=wx. GetStorageSync (' index_2 ')//get the second button index
//the console. The log (' second button index: + value_2)
//style change
WordMsg [value_1] classname='text - bg2';
WordMsg [value_2] classname='text - bg2';
WordMsg [value_1] flag=false;
WordMsg [value_2] flag=false;
The console. The log (wordMsg [value_1] flag, wordMsg [value_2] flag)
//data change and refresh
That the setData ({
WordMsg: wordMsg
})
That the onl oad ()//key to perform the onl oad to obtain current data
//0.5 seconds delay execution
SetTimeout (function () {
//code to be executed delay
WordMsg [value_1] classname='text - bg';
WordMsg [value_2] classname='text - bg';
WordMsg [value_1] textfonname='text - fon1';
WordMsg [value_2] textfonname='text - fon1';
//save data
That the setData ({
WordMsg: wordMsg
})
//refresh
That the onl oad ()//re-execute onl oad to obtain current data
//cache clearing
Wx. ClearStorage ()
}, 500)//delay time is 0.5 seconds here

//record success several

Var index=that. Data. The index
Var=ii index [0]. Ind
+ + ii
The index [0]. Ind=ii
If (==8) ii {
Wx. ReLaunch ({
Url: '../win/win ',
})
The console. The log (' customs')//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- add jump customs clearance page
}
} else {
The console. The log (' judgment failed to enter ')
Var value_1=wx. GetStorageSync (' index_1 ')//get the first button index
Var value_2=wx. GetStorageSync (' index_2 ')//get the second button index
WordMsg [value_1] classname='text - bg3';
WordMsg [value_2] classname='text - bg3';
//data change and refresh
That the setData ({
WordMsg: wordMsg
})
That the onl oad ()//key to perform the onl oad to obtain current data
//0.5 seconds delay execution
SetTimeout (function () {
//code to be executed delay
WordMsg [value_1] classname='text - bg';
WordMsg [value_2] classname='text - bg';
//save data
That the setData ({
WordMsg: wordMsg
})
//refresh
That the onl oad ()//re-execute onl oad to obtain current data
//cache clearing
Wx. ClearStorage ()
}, 500)//delay time is 0.5 seconds here
}
}
},


Then I put the code posted, experience with ios mobile phone use, use the android mobile phone use, click the game interface is an error, but in the real machine debugging on the development platform, the ios and android can use,


Error: thirdScriptError
Always set a property 'classname of undefined; [Component] Event Handler Error @ pages/games/game# bound gameda
TypeError: always set a property 'classname of undefined
The at ye. Gameda (http://127.0.0.1:48173/appservice/pages/games/game.js:270:36)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related