diff --git a/src/css/form.scss b/src/css/form.scss index 565b08d..c850b63 100644 --- a/src/css/form.scss +++ b/src/css/form.scss @@ -155,12 +155,12 @@ &.dark.checked &__label {background:nth($cd, 1) + a0;} &.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.checked &__label::before {left:7px;} + &.disabled &__label::before {right:5px;} + &.disabled.checked &__label::before {left:5px;} } diff --git a/src/form/index.js b/src/form/index.js index 641cf7a..c6afe62 100644 --- a/src/form/index.js +++ b/src/form/index.js @@ -128,6 +128,12 @@ Anot.component('switch', { if (props.hasOwnProperty('disabled')) { 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-fn-noselect') @@ -145,7 +151,7 @@ Anot.component('switch', { ` }, state: { - value: false, + value: null, disabled: false }, methods: { diff --git a/src/layer/index.js b/src/layer/index.js index 13ce4d4..b7f929b 100644 --- a/src/layer/index.js +++ b/src/layer/index.js @@ -36,7 +36,8 @@ const LANGUAGES = { } } 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 layerObj = {} let unique = null // 储存当前打开的1/2/3类型的弹窗 diff --git a/src/meditor/addon/attach-native.js b/src/meditor/addon/attach-native.js index 7a44c22..775d8ad 100644 --- a/src/meditor/addon/attach-native.js +++ b/src/meditor/addon/attach-native.js @@ -81,7 +81,8 @@ const LANGUAGES = { } LANGUAGES['zh-CN'] = 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) { let limit = false diff --git a/src/meditor/addon/attach.js b/src/meditor/addon/attach.js index 0bf1746..d76ba34 100644 --- a/src/meditor/addon/attach.js +++ b/src/meditor/addon/attach.js @@ -79,7 +79,8 @@ const LANGUAGES = { } LANGUAGES['zh-CN'] = 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 { constructor(url) { diff --git a/src/meditor/index.js b/src/meditor/index.js index 097239f..60294b5 100644 --- a/src/meditor/index.js +++ b/src/meditor/index.js @@ -140,7 +140,8 @@ const LANGUAGES = { } LANGUAGES['zh-CN'] = 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({ highlight: function(code, lang) { @@ -507,6 +508,7 @@ Anot.component('meditor', { }, props: { safeMode: true, + revise: Anot.PropsTypes.isFunction(), created: Anot.PropsTypes.isFunction(), onUpdate: Anot.PropsTypes.isFunction(), onFullscreen: Anot.PropsTypes.isFunction() @@ -606,6 +608,9 @@ Anot.component('meditor', { } //只解析,不渲染 this.__tmp__ = marked(txt) + if (typeof this.props.revise === 'function') { + this.__tmp__ = this.props.revise(this.__tmp__) + } } } })