提交 cb178192 编写于 作者: Q qiang

fix: 解决searchInput与app端表现不一致的问题。

上级 193a2c33
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</div> </div>
<div <div
v-if="searchInput" v-if="searchInput"
:style="{'background-color':searchInput.backgroundColor}" :style="{'border-radius':searchInput.borderRadius,'background-color':searchInput.backgroundColor}"
class="uni-page-head-search" class="uni-page-head-search"
> >
<div <div
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
v-model="text" v-model="text"
:focus="searchInput.autoFocus" :focus="searchInput.autoFocus"
:disabled="searchInput.disabled" :disabled="searchInput.disabled"
:style="{'border-radius':searchInput.borderRadius,color:searchInput.color}" :style="{color:searchInput.color}"
:placeholder-style="`color:${searchInput.placeholderColor}`" :placeholder-style="`color:${searchInput.placeholderColor}`"
class="uni-page-head-search-input" class="uni-page-head-search-input"
confirm-type="search" confirm-type="search"
...@@ -116,16 +116,6 @@ uni-page-head .uni-page-head { ...@@ -116,16 +116,6 @@ uni-page-head .uni-page-head {
transition-property: all; transition-property: all;
} }
uni-page-head .uni-page-head.uni-page-head-transparent .uni-page-head-hd > div,
uni-page-head .uni-page-head.uni-page-head-transparent .uni-page-head-ft > div {
display: flex;
align-items: center;
width: 32px;
height: 32px;
background: #999;
border-radius: 50%;
}
uni-page-head .uni-page-head.uni-page-head-transparent .uni-page-head-ft > div { uni-page-head .uni-page-head.uni-page-head-transparent .uni-page-head-ft > div {
justify-content: center; justify-content: center;
} }
...@@ -156,17 +146,23 @@ uni-page-head .uni-page-head-bd { ...@@ -156,17 +146,23 @@ uni-page-head .uni-page-head-bd {
.uni-page-head-btn { .uni-page-head-btn {
position: relative; position: relative;
width: auto; width: auto;
word-break: keep-all;
margin: 0 2px; margin: 0 2px;
word-break: keep-all; word-break: keep-all;
white-space: pre;
} }
.uni-page-head-transparent .uni-page-head-btn{ .uni-page-head-transparent .uni-page-head-btn {
background-color: rgba(153, 153, 153, 1); display: flex;
align-items: center;
width: 32px;
height: 32px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
} }
uni-page-head .uni-btn-icon { uni-page-head .uni-btn-icon {
overflow: hidden; overflow: hidden;
min-width: 1em;
} }
.uni-page-head-btn-red-dot::after { .uni-page-head-btn-red-dot::after {
...@@ -181,7 +177,7 @@ uni-page-head .uni-btn-icon { ...@@ -181,7 +177,7 @@ uni-page-head .uni-btn-icon {
line-height: 18px; line-height: 18px;
border-radius: 18px; border-radius: 18px;
overflow: hidden; overflow: hidden;
transform: scale(0.5) translate(40%,-40%); transform: scale(0.5) translate(40%, -40%);
transform-origin: 100% 0; transform-origin: 100% 0;
} }
...@@ -192,10 +188,10 @@ uni-page-head .uni-btn-icon { ...@@ -192,10 +188,10 @@ uni-page-head .uni-btn-icon {
max-width: 42px; max-width: 42px;
text-align: center; text-align: center;
padding: 0 3px; padding: 0 3px;
transform: scale(0.7) translate(40%,-40%); transform: scale(0.7) translate(40%, -40%);
} }
.uni-page-head-btn-select>.uni-btn-icon::after{ .uni-page-head-btn-select > .uni-btn-icon::after {
display: inline-block; display: inline-block;
font-family: "unibtn"; font-family: "unibtn";
content: "\e601"; content: "\e601";
...@@ -209,13 +205,14 @@ uni-page-head .uni-btn-icon { ...@@ -209,13 +205,14 @@ uni-page-head .uni-btn-icon {
flex: 1; flex: 1;
margin: 0 2px; margin: 0 2px;
line-height: 30px; line-height: 30px;
font-size: 16px; font-size: 15px;
} }
.uni-page-head-search-input { .uni-page-head-search-input {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-left: 34px; padding-left: 34px;
text-align: left;
} }
.uni-page-head-search-placeholder { .uni-page-head-search-placeholder {
...@@ -225,6 +222,7 @@ uni-page-head .uni-btn-icon { ...@@ -225,6 +222,7 @@ uni-page-head .uni-btn-icon {
padding-left: 34px; padding-left: 34px;
overflow: hidden; overflow: hidden;
word-break: keep-all; word-break: keep-all;
white-space: pre;
} }
.uni-page-head-search-placeholder-right { .uni-page-head-search-placeholder-right {
...@@ -355,16 +353,29 @@ export default { ...@@ -355,16 +353,29 @@ export default {
computed: { computed: {
btns () { btns () {
const btns = [] const btns = []
const fonts = {}
if (this.buttons.length) { if (this.buttons.length) {
this.buttons.forEach(button => { this.buttons.forEach(button => {
let btn = Object.assign({}, button) let btn = Object.assign({}, button)
if (btn.fontSrc && !btn.fontFamily) { if (btn.fontSrc && !btn.fontFamily) {
btn.fontSrc = getRealPath(btn.fontSrc) let fontSrc = btn.fontSrc = getRealPath(btn.fontSrc)
const fontFamily = btn.fontSrc.substr(btn.fontSrc.lastIndexOf('/') + 1).replace(/\./g, '-') let fontFamily
if (fontSrc in fonts) {
fontFamily = fonts[fontSrc]
} else {
fontFamily = `font${Date.now()}`
fonts[fontSrc] = fontFamily
const cssText = `@font-face{font-family: "${fontFamily}";src: url("${fontSrc}") format("truetype")}`
appendCss(cssText, 'uni-btn-font-' + fontFamily)
}
btn.fontFamily = fontFamily btn.fontFamily = fontFamily
} }
btn.color = this.type === 'transparent' ? '#fff' : (btn.color || this.textColor) btn.color = this.type === 'transparent' ? '#fff' : (btn.color || this.textColor)
btn.fontSize = btn.fontSize || (this.type === 'default' ? '27px' : '22px') let fontSize = btn.fontSize || (this.type === 'transparent' || btn.text.indexOf('\\u') >= 0 ? '22px' : '27px')
if (/\d$/.test(fontSize)) {
fontSize += 'px'
}
btn.fontSize = fontSize
btn.fontWeight = btn.fontWeight || 'normal' btn.fontWeight = btn.fontWeight || 'normal'
btns.push(btn) btns.push(btn)
}) })
...@@ -412,12 +423,6 @@ export default { ...@@ -412,12 +423,6 @@ export default {
}, },
_formatBtnFontText (btn) { _formatBtnFontText (btn) {
if (btn.fontSrc && btn.fontFamily) { if (btn.fontSrc && btn.fontFamily) {
const cssText =
`@font-face{
font-family: "${btn.fontFamily}";
src: url("${btn.fontSrc}") format("truetype")
}`
appendCss(cssText, 'uni-btn-font-' + btn.fontFamily)
return btn.text.replace('\\u', '&#x') return btn.text.replace('\\u', '&#x')
} else if (FONTS[btn.type]) { } else if (FONTS[btn.type]) {
return FONTS[btn.type] return FONTS[btn.type]
......
...@@ -46,7 +46,8 @@ export default { ...@@ -46,7 +46,8 @@ export default {
transparentElemStyle.backgroundColor = `rgba(${this._R},${this._G},${this._B},${alpha})` transparentElemStyle.backgroundColor = `rgba(${this._R},${this._G},${this._B},${alpha})`
borderRadiusElemsStyles.forEach(function (borderRadiusElemStyle, index) { borderRadiusElemsStyles.forEach(function (borderRadiusElemStyle, index) {
let oldColor = oldColors[index] let oldColor = oldColors[index]
let rgba = oldColor.match(/\d+/g) /* eslint-disable */
let rgba = oldColor.match(/[\d+\.]+/g)
rgba[3] = (1 - alpha) * (rgba.length === 4 ? rgba[3] : 1) rgba[3] = (1 - alpha) * (rgba.length === 4 ? rgba[3] : 1)
borderRadiusElemStyle.backgroundColor = `rgba(${rgba})` borderRadiusElemStyle.backgroundColor = `rgba(${rgba})`
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册