fix: merge replaced Object.assign
https://github.com/d2-projects/d2-admin/issues/342
This commit is contained in:
parent
10223f7aef
commit
37f63bf20c
|
|
@ -1,7 +1,7 @@
|
|||
import { Message } from 'element-ui'
|
||||
import axios from 'axios'
|
||||
import Adapter from 'axios-mock-adapter'
|
||||
import { get, isEmpty } from 'lodash'
|
||||
import { get, isEmpty, merge } from 'lodash'
|
||||
import qs from 'qs'
|
||||
import util from '@/libs/util'
|
||||
import store from '@/store'
|
||||
|
|
@ -132,7 +132,7 @@ function createRequest (service) {
|
|||
baseURL: process.env.VUE_APP_API,
|
||||
data: {}
|
||||
}
|
||||
const option = Object.assign(configDefault, config)
|
||||
const option = merge(configDefault, config)
|
||||
// 处理 get 请求的参数
|
||||
// 请根据实际需要修改
|
||||
if (!isEmpty(option.params)) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { merge } from 'lodash'
|
||||
import BScroll from 'better-scroll'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 滚动优化的选项
|
||||
|
|
@ -22,7 +24,7 @@ export default {
|
|||
methods: {
|
||||
scrollInit () {
|
||||
// 初始化 bs
|
||||
this.BS = new BScroll(this.$refs.wrapper, Object.assign({
|
||||
this.BS = new BScroll(this.$refs.wrapper, merge({
|
||||
mouseWheel: true,
|
||||
click: true,
|
||||
scrollbar: {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { merge } from 'lodash'
|
||||
import SimpleMDE from 'simplemde'
|
||||
import 'simplemde/dist/simplemde.min.css'
|
||||
|
||||
export default {
|
||||
name: 'd2-mde',
|
||||
props: {
|
||||
|
|
@ -44,7 +46,7 @@ export default {
|
|||
// 初始化
|
||||
init () {
|
||||
// 合并参数
|
||||
const config = Object.assign({}, this.defaultConfig, this.config)
|
||||
const config = merge({}, this.defaultConfig, this.config)
|
||||
// 初始化
|
||||
this.mde = new SimpleMDE({
|
||||
...config,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { merge } from 'lodash'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const cookies = {}
|
||||
|
|
@ -12,7 +13,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
|
|||
const currentCookieSetting = {
|
||||
expires: 1
|
||||
}
|
||||
Object.assign(currentCookieSetting, cookieSetting)
|
||||
merge(currentCookieSetting, cookieSetting)
|
||||
Cookies.set(`d2admin-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { cloneDeep, uniq, get } from 'lodash'
|
||||
import { cloneDeep, uniq, get, merge } from 'lodash'
|
||||
import router from '@/router'
|
||||
import setting from '@/setting.js'
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ export default {
|
|||
valid.push(find ? 1 : 0)
|
||||
// 返回合并后的数据 新的覆盖旧的
|
||||
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
|
||||
return Object.assign({}, opened, find)
|
||||
return merge({}, opened, find)
|
||||
})
|
||||
.filter((opened, index) => valid[index] === 1)
|
||||
// 标记已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
|
||||
|
|
@ -164,7 +164,7 @@ export default {
|
|||
// 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示
|
||||
if (page) {
|
||||
await dispatch('add', {
|
||||
tag: Object.assign({}, page),
|
||||
tag: merge({}, page),
|
||||
params,
|
||||
query,
|
||||
fullPath
|
||||
|
|
|
|||
Loading…
Reference in New Issue