Some common bugs and solutions

1. After passing this.$route.push(''/xxx''), the menu bar is not highlighted by default when switching for the first time. Solution
: Use the route attribute. At the same time, in order to ensure that the index attribute and the default-active attribute are consistent, change the route's The name attribute is set to index and default-active

2.element-ui reset form resetFields() will affect the original data in the table.
Open the dialog box to modify a certain row of data and close it without making any changes. The @close method is triggered, and this.refs [ ′ F orm ′ is executed in the method. ] . reset Fields ( ), then open the dialog box of other rows and then close it. The contents of the fields of other rows of data in the table will become the data of the first selected row. Solution: Use this . refs['Form'].resetFields(), then open the dialog box of other rows and then close it. The contents of the fields of other rows of data in the table will become the data of the first selected row. Solution: use this.refs[Form ].resetFields(), then open the dialog box of other rows and then close it. The contents of the fields of other rows of data in the table will become the data of the first selected row. Solution: Usethis.nextTick
https://blog.csdn.net/gujian_peachblossom/article/details/117254326

3. The problem that the parameters of @Pathvariable are allowed to be empty.
Sometimes calling the interface parameter of the @Pathvariable annotation is empty, which will result in an error being reported because the interface cannot be found.
The solution:
@PathVariable(value = “userName”, required = false) (here required = false does not solve the problem yet)
@GetMapping(value = {“/check/{userName}”, “/check/”}) (must have the following url)
https://blog.csdn.net/qq_37210826/ article/details/88291087

4.vue gives the object to a variable and changes the value of the variable, the source object will also change.
Solution: this.optionB=JSON.parse(JSON.stringify(this.optionA))

5. The spring-boot version is too high, causing cross-domain problems when using allowedOrigins ("*").
Solution: It should be replaced with .allowedOriginPatterns or the spring-boot version should be lowered.

6. The vue-router version is too low and there is no error message caused by the router.addRoute() method.
Solution: Use the router.addRoutes() method or upgrade the vue-router version.

7. Mybatis-plus does not work when updating fields to null or empty values ​​using update()/updateById().
Solution:
1. In the configuration file, set the global field-strategy
2. Set the fields individually
@TableField (value="score",strategy=FieldStrategy.IGNORED)
https://www.cnblogs.com/ngy0217/p/14830401.html

8.elementUI table paging, the check box will become unchecked after turning the page.
Solution: Add the :reserve-selection="true" attribute to the check box column, and add the :row-key="rowKeys" attribute to the el-table. rowKey is a method: rowKeys(row) { return
row . id //The id here is row data, written according to its own field name } You need to clear the selected check box and call this.$refs.(el-table's ref attribute value).clearSelection() https://blog. csdn.net/qq_34103387/article/details/103278198



**9. Use vuex to report an error indicating that the store cannot be found. ∗ ∗ Solution: Instantiate vue 2 in main. js: new V ue (router, store, render: h = > h (A pp)). store. ** Solution: Instantiate vue2 in main.js by writing: new Vue({ router, store, render: h => h(App) }).storeSolution: Instantiate vu e 2 in main . j s : n e w V u e ( ro u t er ,store,render:h=>h ( A pp ) ) . mount('#app')
How to write vue3:
const app = createApp(App)
app.user(router)
app.use(store)
app.mount('#app')
and vuex starts from 4.0 The version can only be used through vue3 writing method. Because the project uses vue2, you need to change the vuex version to a version before 4.

10. You cannot use vue’s prototype chain to mount the calling interface (this.$http.get(this.API.getMenuInfo,)) in vuex.
Solution: According to the blog http://t.zoukankan.com/jackson-yqj- p-10303364.html is solved using the axios access interface.

**11.vue+el-menu recursion causes emit to fail ** ∗ Solution: add: v − bind = " emit fails in the label of the subcomponent call itself** Solution: add: v- in the label of the subcomponent call itself bind="e mi t invalidSolution: Add: v within the tag of the subcomponent call itselfbind="attrs" v-on=“$listeners”
https://blog.csdn.net/real_xiaobai/article/details/120547278

12. After delete deletes the array members, the length of the array will not change, causing an error during the next traversal.
Solution: Use the splice method to delete.

13. How to use the vue component treeselect to prohibit the selection of certain nodes.
Example: There are three types of drop-down nodes (codenamed 1, 2, 3). If the type is 1 or 2, the node is prohibited from being selected.
Solution: Set the component attribute: flat="true", and add isDisabled: node.type to the object returned in the my_normalizer method of the component: normalizer="my_normalizer" attribute.1 || node.type2 ? true : false
https://www.cnblogs.com/Guhongying/p/14514577.html

14.Springboot batch operations on the database require the use of transactions.
Solution: https://blog.csdn.net/qq_48922459/article/details/122391710

Guess you like

Origin blog.csdn.net/weixin_44428163/article/details/126170850