Skip to content

Commit

Permalink
x-dialog: fix prevent-body-scroll.css not found (less-loader issue) #…
Browse files Browse the repository at this point in the history
  • Loading branch information
airyland committed Nov 2, 2017
1 parent 6278a82 commit 2d4b155
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/components/x-dialog/metas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ slots:
en: main content of the dialog
zh-CN: 弹窗的主体内容
changes:
next:
en:
- '[fix] fix prevent-body-scroll.css not found (less-loader issue) #2118'
zh-CN:
- '[fix] 修复 prevent-body-scroll.css 无法找到问题(less-loader) #2118'
v2.7.0:
en:
- '[feature] add event:on-click-mask #2102'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<script>
/* this component is used just for importing style (avoid less-loader issue) */
export default {}
</script>

<style>
.vux-modal-open {
overflow: hidden;
position: fixed;
width: 100%;
}
.vux-modal-open-for-container {
overflow: hidden!important;
}
}
</style>
8 changes: 5 additions & 3 deletions src/mixins/prevent-body-scroll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dom from '../libs/dom'
require('./prevent-body-scroll.css')
import style from './prevent-body-scroll.css.vue' // eslint-disable-line

const BODY_CLASS_NAME = 'vux-modal-open'
const CONTAINER_CLASS_NAME = 'vux-modal-open-for-container'
Expand All @@ -9,8 +9,10 @@ export default {
methods: {
// some plugin may be imported before configPlugin, so we cannot get gloal config when component is created
getLayout () {
if (this.$vux && this.$vux.config && this.$vux.config.$layout === 'VIEW_BOX') {
return 'VIEW_BOX'
if (typeof window !== 'undefined') {
if (window.VUX_CONFIG && window.VUX_CONFIG.$layout === 'VIEW_BOX') {
return 'VIEW_BOX'
}
}
return ''
},
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export default {
Vue.vux.config = config
}

if (typeof window !== 'undefined') {
window.VUX_CONFIG = config
}

Vue.mixin({
created: function () {
if (this.$vux) {
Expand Down

0 comments on commit 2d4b155

Please sign in to comment.