Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_41894708
vue-devtools
提交
bcb165df
V
vue-devtools
项目概览
qq_41894708
/
vue-devtools
与 Fork 源项目一致
从无法访问的项目Fork
通知
18
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-devtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bcb165df
编写于
2月 03, 2019
作者:
E
Emanuel Mutschlechner
提交者:
Guillaume Chau
2月 03, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Make props editable, closes #669 (#813)
* feat: Make props editable * feat: switch in settings
上级
8167e3c8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
6 deletion
+35
-6
src/backend/index.js
src/backend/index.js
+7
-3
src/devtools/views/settings/GlobalPreferences.vue
src/devtools/views/settings/GlobalPreferences.vue
+15
-1
src/shared-data.js
src/shared-data.js
+4
-2
src/util.js
src/util.js
+9
-0
未找到文件。
src/backend/index.js
浏览文件 @
bcb165df
...
...
@@ -7,7 +7,7 @@ import { initEventsBackend } from './events'
import
{
initRouterBackend
}
from
'
./router
'
import
{
initPerfBackend
}
from
'
./perf
'
import
{
findRelatedComponent
}
from
'
./utils
'
import
{
stringify
,
classify
,
camelize
,
set
,
parse
,
getComponentName
,
getCustomRefDetails
}
from
'
../util
'
import
{
stringify
,
classify
,
camelize
,
set
,
has
,
parse
,
getComponentName
,
getCustomRefDetails
}
from
'
../util
'
import
ComponentSelector
from
'
./component-selector
'
import
SharedData
,
{
init
as
initSharedData
}
from
'
src/shared-data
'
import
{
isBrowser
,
target
}
from
'
src/devtools/env
'
...
...
@@ -629,7 +629,8 @@ function processProps (instance) {
required
:
!!
prop
.
required
}
:
{
type
:
'
invalid
'
}
},
editable
:
SharedData
.
editableProps
})
}
return
propsData
...
...
@@ -959,7 +960,10 @@ function setStateValue ({ id, path, value, newKey, remove }) {
$set
:
hook
.
Vue
.
set
,
$delete
:
hook
.
Vue
.
delete
}
:
instance
set
(
instance
.
_data
,
path
,
parsedValue
,
(
obj
,
field
,
value
)
=>
{
const
data
=
has
(
instance
.
_props
,
path
,
newKey
)
?
instance
.
_props
:
instance
.
_data
set
(
data
,
path
,
parsedValue
,
(
obj
,
field
,
value
)
=>
{
(
remove
||
newKey
)
&&
api
.
$delete
(
obj
,
field
)
!
remove
&&
api
.
$set
(
obj
,
newKey
||
field
,
value
)
})
...
...
src/devtools/views/settings/GlobalPreferences.vue
浏览文件 @
bcb165df
<
template
>
<div
class=
"global-preferences preferences"
>
<VueFormField
title=
"Normalize
Component N
ames"
>
<VueFormField
title=
"Normalize
component n
ames"
>
<VueGroup
:value=
"$shared.classifyComponents"
class=
"extend"
...
...
@@ -58,5 +58,19 @@
/>
</VueGroup>
</VueFormField>
<VueFormField
title=
"Editable props"
>
<VueSwitch
:value=
"$shared.editableProps"
@
input=
"$shared.editableProps = $event"
>
Enable
<span
class=
"dim"
>
(may print warnings)
</span>
</VueSwitch>
</VueFormField>
</div>
</
template
>
<
style
lang=
"stylus"
scoped
>
.dim
color $darkerGrey
</
style
>
src/shared-data.js
浏览文件 @
bcb165df
...
...
@@ -8,14 +8,16 @@ const internalSharedData = {
cacheVuexSnapshotsEvery
:
50
,
cacheVuexSnapshotsLimit
:
10
,
snapshotLoading
:
null
,
recordPerf
:
false
recordPerf
:
false
,
editableProps
:
false
}
const
persisted
=
[
'
classifyComponents
'
,
'
theme
'
,
'
displayDensity
'
,
'
recordVuex
'
'
recordVuex
'
,
'
editableProps
'
]
// ---- INTERNALS ---- //
...
...
src/util.js
浏览文件 @
bcb165df
...
...
@@ -519,6 +519,15 @@ export function get (object, path) {
return
object
}
export
function
has
(
object
,
path
,
parent
=
false
)
{
const
sections
=
path
.
split
(
'
.
'
)
const
size
=
!
parent
?
1
:
2
while
(
sections
.
length
>
size
)
{
object
=
object
[
sections
.
shift
()]
}
return
object
!=
null
&&
object
.
hasOwnProperty
(
sections
[
0
])
}
export
function
scrollIntoView
(
scrollParent
,
el
,
center
=
true
)
{
const
parentTop
=
scrollParent
.
scrollTop
const
parentHeight
=
scrollParent
.
offsetHeight
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录