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(user-head): the problem and type of the demo on the mobile client are modified #2699

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
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: 4 additions & 5 deletions examples/sites/demos/mobile/app/user-head/basic-usage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<div class="title">尺寸</div>
<div class="item-content">
<tiny-user-head type="label" v-model="name" :size="80" round></tiny-user-head>
<tiny-user-head type="label" v-model="name" size="large" round></tiny-user-head>
<tiny-user-head type="label" v-model="name" size="medium" round></tiny-user-head>
<tiny-user-head type="label" v-model="namePrefix" size="small" round></tiny-user-head>
<tiny-user-head type="label" v-model="name" :size="70" round></tiny-user-head>
<tiny-user-head type="label" v-model="name" :size="60" round></tiny-user-head>
<tiny-user-head type="label" v-model="name" :size="50" round></tiny-user-head>
</div>

<div class="title">类型</div>
Expand Down Expand Up @@ -35,8 +35,7 @@ export default {
data() {
return {
imageUrl: `${import.meta.env.VITE_APP_BUILD_BASE_URL}static/images/fruit.jpg`,
name: '小明',
namePrefix: '小'
name: '小明'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<tiny-user-head type="icon" background-color="var(--ti-common-color-line-active)"></tiny-user-head>
<tiny-user-head type="icon" background-color="'#5E7CE0'"></tiny-user-head>
</template>

<script lang="jsx">
Expand Down
12 changes: 0 additions & 12 deletions examples/sites/demos/mobile/app/user-head/webdoc/user-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,6 @@ export default {
},
codeFiles: ['min-user-head.vue']
},
{
demoId: 'render-user-head-in-grid',
name: {
'zh-CN': '渲染用户头像在网格中',
'en-US': 'button type'
},
desc: {
'zh-CN': '<p>渲染用户头像在网格中</p>',
'en-US': '<p>button type</p>'
},
codeFiles: ['render-user-head-in-grid.vue']
},
{
demoId: 'round-user-head',
name: {
Expand Down
8 changes: 2 additions & 6 deletions packages/mobile/components/user-head/src/renderless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const computedMessage =
({ props }: Pick<IUserHeadRenderlessParams, 'props'>) =>
() => {
let result = ''
const total = Math.floor(props.messageTotal || NaN)
const total = Math.floor(Number(props.messageTotal) || NaN)

if (props.messageType === 'details' && !isNaN(total) && total > 0) {
result = String(total)
Expand Down Expand Up @@ -65,11 +65,7 @@ export const computedFontSize =
6: `${state.size / 9}px`
}

if (mode === 'mobile-first') {
fontSize = mfsizeMap[length]
} else {
fontSize = sizeMap[length]
}
fontSize = sizeMap[length]
}

return { fontSize }
Expand Down
5 changes: 3 additions & 2 deletions packages/mobile/components/user-head/src/user-head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

import type { ExtractPropTypes } from 'vue'
import type { ISharedRenderlessFunctionParams, ISharedRenderlessParamUtils } from '../../../types/shared.type'
export type { ISharedRenderlessParamHooks } from '../../../types/shared.type'
import type { computedFontSize, computedLabel, computedMessage, computedStyle, getInternalValue } from './renderless'

export type { ISharedRenderlessParamHooks } from '../../../types/shared.type'

export const $constants = {
ITEM_NAME: '.user-head-item'
}
Expand Down Expand Up @@ -80,7 +81,7 @@ export const userHeadProps = {
/**
* @property {Number} - 消息计数
*/
messageTotal: Number,
messageTotal: [Number, String],

/**
* @property {String} [messageType=details] - 消息类型 details|basic 可选
Expand Down
Loading