-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:add theme switching plugin #1070
base: refactor/develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,10 @@ | |
</template> | ||
</component> | ||
<slot></slot> | ||
<span v-if="state.options?.collapsed">{{ state.content }}</span> | ||
<span v-if="isHideMulti()">{{ state.content }}</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</span> | ||
<span> </span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里的空 span 有什么用? |
||
<slot name="radio"></slot> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要增加 |
||
</template> | ||
|
||
<script> | ||
|
@@ -32,6 +34,10 @@ export default { | |
options: { | ||
type: Object, | ||
default: () => {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 默认值应该是: |
||
}, | ||
position: { | ||
type: String, | ||
default: 'right' | ||
} | ||
}, | ||
emits: ['click-api'], | ||
|
@@ -46,21 +52,28 @@ export default { | |
emit('click-api') | ||
} | ||
|
||
const isShowMulti = () => (state.options?.collapsed || props.position === 'collapse') && state.options?.multiType | ||
chilingling marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const isHideMulti = () => (state.options?.collapsed || props.position === 'collapse') && !state.options?.multiType | ||
|
||
const getRender = () => { | ||
switch (props.options.renderType) { | ||
case 'button': | ||
return ToolbarBaseButton | ||
case 'icon': | ||
return ToolbarBaseIcon | ||
default: | ||
return false | ||
if (isShowMulti()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里 |
||
return false | ||
} | ||
if (props.options.renderType === 'button') { | ||
return ToolbarBaseButton | ||
} | ||
if (props.options.renderType === 'icon') { | ||
return ToolbarBaseIcon | ||
} | ||
return false | ||
} | ||
|
||
return { | ||
state, | ||
click, | ||
getRender | ||
getRender, | ||
isShowMulti, | ||
isHideMulti | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,7 +8,7 @@ export const generateConfig = (options = {}) => { | |||||||||||||||||||||||||||||
const configContent = ` | ||||||||||||||||||||||||||||||
export default { | ||||||||||||||||||||||||||||||
id: 'engine.config', | ||||||||||||||||||||||||||||||
theme: import.meta.env.VITE_THEME || '${theme}', | ||||||||||||||||||||||||||||||
theme: '${theme}', | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||
material: ${JSON.stringify(material)}, | ||||||||||||||||||||||||||||||
scripts: ${JSON.stringify(scripts)}, | ||||||||||||||||||||||||||||||
styles: ${JSON.stringify(styles)}, | ||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,16 @@ export default { | |
left: ['engine.toolbars.breadcrumb', 'engine.toolbars.lock', 'engine.toolbars.logo'], | ||
center: ['engine.toolbars.media'], | ||
right: [ | ||
['engine.toolbars.redoundo', 'engine.toolbars.clean'], | ||
['engine.toolbars.theme', 'engine.toolbars.redoundo', 'engine.toolbars.clean'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 建议工具栏和收缩下拉菜单放一个主题切换的工具就好了 |
||
['engine.toolbars.preview'], | ||
['engine.toolbars.generate-code', 'engine.toolbars.save'] | ||
], | ||
collapse: [ | ||
['engine.toolbars.collaboration'], | ||
['engine.toolbars.refresh', 'engine.toolbars.fullscreen'], | ||
['engine.toolbars.lang'], | ||
['engine.toolbars.viewSetting'] | ||
['engine.toolbars.viewSetting'], | ||
['engine.toolbars.theme'] | ||
] | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
插件名看看换成:
engine.toolbars.themeSwitch
是不是好一点?engine.toolbars.theme
可能会容易误解成工具栏的主题。