未验证 提交 72f44e7c 编写于 作者: Mr.奇淼('s avatar Mr.奇淼( 提交者: GitHub

修复后端重启前端白屏的bug

修复后端重启前端白屏的bug
......@@ -36,6 +36,7 @@ func Viper(path ...string) *viper.Viper {
v := viper.New()
v.SetConfigFile(config)
v.SetConfigType("yaml")
err := v.ReadInConfig()
if err != nil {
panic(fmt.Errorf("Fatal error config file: %s \n", err))
......
......@@ -18,7 +18,11 @@ func StructToMap(obj interface{}) map[string]interface{} {
var data = make(map[string]interface{})
for i := 0; i < obj1.NumField(); i++ {
data[obj1.Field(i).Name] = obj2.Field(i).Interface()
if obj1.Field(i).Tag.Get("mapstructure") != "" {
data[obj1.Field(i).Tag.Get("mapstructure")] = obj2.Field(i).Interface()
} else {
data[obj1.Field(i).Name] = obj2.Field(i).Interface()
}
}
return data
}
......
......@@ -24,9 +24,7 @@ router.beforeEach(async (to, from, next) => {
asyncRouterFlag++
await store.dispatch('router/SetAsyncRouter')
const asyncRouters = store.getters['router/asyncRouters']
asyncRouters.forEach(item => {
router.addRoute(item)
})
router.addRoutes(asyncRouters)
next({ ...to, replace: true })
} else {
if (to.matched.length) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册