Skip to content
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

fix(h5): modal 类名和 2.x 保持一致 #9305

Merged
merged 3 commits into from
Jul 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/taro-h5/src/api/interactive/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ export default class Modal {

// mask
const mask = document.createElement('div')
mask.className = 'taro-modal__mask'
mask.setAttribute('style', inlineStyle(maskStyle))

// modal
const modal = document.createElement('div')
modal.className = 'taro-modal__content'
modal.setAttribute('style', inlineStyle(modalStyle))

// title
Expand All @@ -95,6 +97,8 @@ export default class Modal {
display: 'none'
}
this.title = document.createElement('div')

this.title.className = 'taro-modal__title'
this.title.setAttribute('style', inlineStyle(titleCSS))
this.title.textContent = config.title

Expand All @@ -105,6 +109,7 @@ export default class Modal {
color: '#353535'
}
this.text = document.createElement('div')
this.text.className = 'taro-modal__text'
this.text.setAttribute('style', inlineStyle(textCSS))
this.text.textContent = config.content

Expand All @@ -120,7 +125,7 @@ export default class Modal {
display: config.showCancel ? 'block' : 'none'
}
this.cancel = document.createElement('div')
this.cancel.className = 'taro-model__btn'
this.cancel.className = 'taro-model__btn taro-model__cancel'
this.cancel.setAttribute('style', inlineStyle(cancelCSS))
this.cancel.textContent = config.cancelText
this.cancel.onclick = () => {
Expand All @@ -133,7 +138,7 @@ export default class Modal {

// confirm button
this.confirm = document.createElement('div')
this.confirm.className = 'taro-model__btn'
this.confirm.className = 'taro-model__btn taro-model__confirm'
this.confirm.setAttribute('style', inlineStyle(btnStyle))
this.confirm.style.color = config.confirmColor
this.confirm.textContent = config.confirmText
Expand Down