During front-end development, if the back-end interface has not been written yet, you can first write the test data in the js file, and import the data in the file to check whether the web logic is correct.
Test Data
Create a js file
const testData = {
MatchFieldList: {
MatchField: [
{
ID: 1,
UserDefine: "11",
PlatformDefine: 0
},
{
ID: 2,
UserDefine: "22",
PlatformDefine: 1
}
],
TotalNum: 2,
PageIndex: 0,
PageSize: 0
}
};
export default testData;
used in the vue file
introduce
import testData from './testData.js';
use
Print testData.MatchFieldList; you can get the data
return as promise type
Some scenarios need to wrap the test data as a promise return
return new Promise(resolve => {
console.log("testData.testData", testData.MatchFieldList);
resolve(testData.MatchFieldList);
});