This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化语言包选择逻辑;优化switch组件checked属性和样式;meditor增加revise回调,允许用户对md编译后的修正

old
宇天 2018-08-15 12:27:57 +08:00
parent 020a142bfb
commit e25ff4286e
6 changed files with 23 additions and 9 deletions

View File

@ -155,12 +155,12 @@
&.dark.checked &__label {background:nth($cd, 1) + a0;} &.dark.checked &__label {background:nth($cd, 1) + a0;}
&.disabled.checked &__dot {background:#fff;} &.disabled.checked &__dot {background:#fff;}
&.disabled &__label, &.disabled.checked &__label {background:nth($cp, 1); &.disabled &__label, &.disabled.checked &__label {
&::before {display:block;position:absolute;top:6px;width:8px;height:4px;border-radius:2px;background:#fff;content:"";} &::before {display:block;position:absolute;top:5px;width:8px;height:4px;border-radius:2px;background:#fff;content:"";}
} }
&.disabled &__label::before {right:7px;} &.disabled &__label::before {right:5px;}
&.disabled.checked &__label::before {left:7px;} &.disabled.checked &__label::before {left:5px;}
} }

View File

@ -128,6 +128,12 @@ Anot.component('switch', {
if (props.hasOwnProperty('disabled')) { if (props.hasOwnProperty('disabled')) {
state.disabled = true state.disabled = true
} }
if (props.hasOwnProperty('checked')) {
if (state.value === null) {
state.value = true
}
}
state.value = !!state.value
this.classList.add('do-switch') this.classList.add('do-switch')
this.classList.add('do-fn-noselect') this.classList.add('do-fn-noselect')
@ -145,7 +151,7 @@ Anot.component('switch', {
` `
}, },
state: { state: {
value: false, value: null,
disabled: false disabled: false
}, },
methods: { methods: {

View File

@ -36,7 +36,8 @@ const LANGUAGES = {
} }
} }
LANGUAGES['zh-CN'] = LANGUAGES.zh LANGUAGES['zh-CN'] = LANGUAGES.zh
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en const lang =
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
let layerDom = {} let layerDom = {}
let layerObj = {} let layerObj = {}
let unique = null // 储存当前打开的1/2/3类型的弹窗 let unique = null // 储存当前打开的1/2/3类型的弹窗

View File

@ -81,7 +81,8 @@ const LANGUAGES = {
} }
LANGUAGES['zh-CN'] = LANGUAGES.zh LANGUAGES['zh-CN'] = LANGUAGES.zh
LANGUAGES['zh-TW'] = LANGUAGES.zh LANGUAGES['zh-TW'] = LANGUAGES.zh
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en const lang =
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
const fixCont = function(vm, tool) { const fixCont = function(vm, tool) {
let limit = false let limit = false

View File

@ -79,7 +79,8 @@ const LANGUAGES = {
} }
LANGUAGES['zh-CN'] = LANGUAGES.zh LANGUAGES['zh-CN'] = LANGUAGES.zh
LANGUAGES['zh-TW'] = LANGUAGES.zh LANGUAGES['zh-TW'] = LANGUAGES.zh
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en const lang =
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
class Uploader { class Uploader {
constructor(url) { constructor(url) {

View File

@ -140,7 +140,8 @@ const LANGUAGES = {
} }
LANGUAGES['zh-CN'] = LANGUAGES.zh LANGUAGES['zh-CN'] = LANGUAGES.zh
LANGUAGES['zh-TW'] = LANGUAGES.zh LANGUAGES['zh-TW'] = LANGUAGES.zh
const lang = LANGUAGES[Anot.language || navigator.language] || LANGUAGES.en const lang =
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.en
marked.setOptions({ marked.setOptions({
highlight: function(code, lang) { highlight: function(code, lang) {
@ -507,6 +508,7 @@ Anot.component('meditor', {
}, },
props: { props: {
safeMode: true, safeMode: true,
revise: Anot.PropsTypes.isFunction(),
created: Anot.PropsTypes.isFunction(), created: Anot.PropsTypes.isFunction(),
onUpdate: Anot.PropsTypes.isFunction(), onUpdate: Anot.PropsTypes.isFunction(),
onFullscreen: Anot.PropsTypes.isFunction() onFullscreen: Anot.PropsTypes.isFunction()
@ -606,6 +608,9 @@ Anot.component('meditor', {
} }
//只解析,不渲染 //只解析,不渲染
this.__tmp__ = marked(txt) this.__tmp__ = marked(txt)
if (typeof this.props.revise === 'function') {
this.__tmp__ = this.props.revise(this.__tmp__)
}
} }
} }
}) })