Applet – error XXX is not defined (resolved)
Problem situation:
for such a piece of code, the error reported by wechat applet is not defined
I wxml want to call
//wxml code
<view class='ltext'>{{_typeTitle}}</view>
I make mistakes like this
Page({
data: {
titleArray: ['01 A trial platform', ‘02 A trial platform’,'03 ...' ],
},
onLoad: function (options) {
var that = this;
var _typeTitle = titleArray[1];
that.setData({
_typeTitle: _typeTitle,
})
},
})
why is it defined in data, but it can’t be used?
This is one of the common mistakes when novices learn. They can’t call directly by name
correct method
Page({
data: {
titleArray: ['01 A trial platform', ‘02 A trial platform’,'03 ...' ],
},
onLoad: function (options) {
var that = this;
var _typeTitle = this.data.titleArray[1];
that.setData({
_typeTitle: _typeTitle,
})
},
})
Similar Posts:
- Pyqt5: How to solve the uncaught referenceerror when Python uses qwebengineview
- ”Cannot read property ‘addEventListener’ of null“
- Error in JS function referencing public page [How to Solve]
- The Difference between $(document).ready, window.onload and $(window).load(function (){})
- Uniapp WeChat applet Error: “jsEnginScriptError Component is not found in path ” “UView”
- Solve the problem of “java.lang.UnsatisfiedLinkError: Native Library .dll already loaded in another classloader”
- [Solved] Uniapp Axios appears in wechat applet index.js? [SM]: 33 errortyerror: l is not a function error
- The Difference between Document.ready and Window.onload
- The applet reports an error thirdscripterror DateValue is not defined;
- [Solved] The problem that JNI_onload function does not exist