有时候 uni-app 没有,而微信小程序有。因此,需要将微信小程序的代码转换为 uni-app 的代码
Page({
data: {
text: "Hello, World!"
},
onLoad: function() {
console.log("Page loaded");
}
})
转换为 uni-app 的以下代码:
Page({
data() {
return {
text: "Hello, World!"
}
},
onLoad() {
console.log("Page loaded");
}
})
var sceneReadyBehavior = require('../../behavior-scene/scene-ready');
Page({
behaviors:[sceneReadyBehavior],
data: {
xmlCode: '' + handleDecodedXML(xmlCode) + '',
}
});
转换为 uni-app 代码
<script>
import sceneReadyBehavior from '@/lib/js/scene-ready.js'
export default {
behaviors: [sceneReadyBehavior],
data() {
return {
xmlCode: ''
};
}
};
</script>