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

菜单中的图标能否放在后面,而不是在菜单前面 #5355

Closed
qyh214 opened this issue Oct 31, 2023 · 1 comment
Closed

菜单中的图标能否放在后面,而不是在菜单前面 #5355

qyh214 opened this issue Oct 31, 2023 · 1 comment
Labels
untriaged need to sort

Comments

@qyh214
Copy link

qyh214 commented Oct 31, 2023

TuSimple/naive-ui version (版本)

2.35.0

Vue version (Vue 版本)

3.3.7

Browser and its version (浏览器及其版本)

Microsoft Edge 版本 118.0.2088.76

System and its version (系统及其版本)

win11

Node version (Node 版本)

Reappearance link (重现链接)

https://www.naiveui.com/zh-CN/os-theme/components/menu

Reappearance steps (重现步骤)

按照https://www.naiveui.com/zh-CN/os-theme/components/menu的说明随便写的demo

Expected results (期望的结果)

期望能控制图标是否在菜单名字的前面或者后面

例如,帮助? ?帮助 这两种都能设置

Actual results (实际的结果)

只能让图标在菜单文字前面,例如?帮助

Remarks (补充说明)

@github-actions github-actions bot added the untriaged need to sort label Oct 31, 2023
@yuding-x
Copy link

//MenuOption
{
    label: renderSearch(inputstr.value),
    key: 'search'
  },
function renderSearch (num:string) {
  return () => 
    h(NInput, 
    {
      style:{
        width:'30vw'
      },
      props:{
        value:num,
      },
      class:"h-input",
      placeholder:'搜索',
      onInput:(value)=>{console.log('input', value)},
      onFocus:()=>{historyTabVisible.value = true},
      onBlur:()=>{historyTabVisible.value = false}
    },
      {
//icon渲染
        suffix:renderIcon(Search)
      }
    )
}

function renderIcon (icon: Component) {
  return () => h(NIcon, null, { default: () => h(icon) })
}

或许你可以试试用h渲染函数实现

@qyh214 qyh214 closed this as completed Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

No branches or pull requests

2 participants