1. Arrow function
-
Parameter {}
-
If you have more than one argument, you need to enclose it in ()
-
Does the statement have {}
-
If there are multiple statements, use {} and return
-
{} and return can be omitted if there is only one statement, but {} must be returned otherwise the value will not be retrieved.
-
Return object case, {} change () for example ({name:’ Jennie ‘})
2. v-for
-
Duplicate keys detected: ‘0’. This may cause an update error.
-
Error: A template contains two identical V-for keys with the same name as index
-
Key =”‘project-‘+index”
3. Vant checkbox component
- An error as shown in figure
Check the value type of your V-model binding. I’m using van-checkbox-group, so I should bind to an array.
4. Another difference between ForEach and for of (I didn’t know before)
5. The importance of try catch
If you do not add a try catch to the code, it will not continue to execute after an error, which is not what we expect, so use it !!!!
6. Cannot read length of undefined
Solution: Add v-if to the overall code so that no data can be rendered.
7. Use kab-case to emit methods for child and parent components
@go-next=”goEpDetail(enterprise.id)”
8. File …. is not a module
The reason is that the script tag is not closed
10. Vue warn]: Error in v-on handler: “TypeError: Cannot read property ‘popup’ of undefined”
9. (Windows /… The statement as any must be followed by a semicolon
10. The version number in config. XML controls the version number of the interface during installation
The version number in main.ts is to record the previous version number of config. XML locally and compare it with the new installation package version of the backend to determine whether it can be updated. Therefore, the latest version number in config. XML is the version number of the backend. It’s just so we can see if we can update it.
Therefore, we only need to change version in config. XML to the latest version number, and version in main.ts to the previous version number in config.xml.
11. There are two ways to control version updates
1. Mount vue prototype in main.ts, 2 package.json, vue.
12. When using minxin of SCSS, remember to configure it in vue.config.js
module.exports = { publicPath: '', css: { loaderOptions: { sass: { additionalData: '@import "@/styles/variables.scss"; '}}}} I SCSS version is: "sass" : "^ 1.26.5", "sass - loader" : "^ 10.0.1",Copy the code
13. Use &&, | | make the code more concise
< span > {{myInfo. UserExtend. Address | | '-'}} < / span > replace logic or short-circuit characteristics, convenient we offer alternate value. <span>{{selfInfo.userExtend.address? SelfInfo. UserExtend. Address: '-'}} < / span > logic and the if (data & & data. The length > 0) logic and short-circuit characteristics, if the data is empty, then won't do the data. The length of the judgmentCopy the code
14. If babel.config.js is configured with local import UI components, then global import will fail, such as ViewUI is undefined
babel.config.js
[ "import", { "libraryName": "view-design", "libraryDirectory": "src/components" }, "view-design" ], [ "import", { "libraryName": "iview", "libraryDirectory": "src/components" }, "iview" ],
Copy the code
15. Cordova package error When running cordova Run Android, an error occurs
No Java files found which extend CordovaActivity.
Solution: Delete Platforms and then cordova add Platform Android.
All you need to do is remove platform cordova platform rm android and re-add platform by typing cordova platform add android, and the error goes away.!!!
Androidmanifest.xml may be reported in the package after this step, just follow the prompts.
16. The third-party app registers on wechat
Config. XML, androidmanifest.xml package name should be the same as the package name filled in wechat application, if wechat development (or public? The app package name in the platform is the same as the apK package, so the signature will be the same.
17. How to judge whether the third-party app has successfully authorized wechat login
Look at it in two places:
The first one: I – privacy – authorization management
The second: I — account and security — wechat security center — logout account can see their bound procedures — click back!
90. [vue-router] Root user management ‘has a default child Route. In this code (:to=”{name: Navigating: ‘rules user management ‘”), the default child route will not be rendered. Remove the name from this route and use the name of the default child route for named links instead.
Do not: to=”{name=””}” use path directly
19. When cordova app is being packaged, a password error is reported at the last step of signing the app. In this case, NPM run serve and run the signature command again !!!! I don’t know why.
20. The form component remembers to set input limits, such as maxLength
21. The delete body of Axios refers to the history of blood and tears. Different from the body in post, it will not be recognized if written directly, so it needs to be wrapped with {data:}
22. NPM install dependencies
Error as follows:
To resolve the problem, switch to a CMD window and then NPM I
Baidu on the view is the administrator identity run CMD command, switch to taobao mirror