Comments (1)
将结构改成这样就行了。
<script setup lang="ts">
import { NButton } from 'naive-ui'
import { defineModel } from 'vue'
import { NBadge } from 'naive-ui'
const buttonType = defineModel<'default' | 'primary'>('state', { default: 'default' })
function toggleButtonType() {
buttonType.value = buttonType.value === 'default' ? 'primary' : 'default'
}
const remaining = defineModel<number>('remaining', { default: 9 })
</script>
<template>
<n-badge :value="remaining" type="info">
<n-button :focusable="false" :type="buttonType" @click="toggleButtonType"></n-button>
<template #value>
<slot></slot>
</template>
</n-badge>
</template>
<style scoped>
.n-button {
width: 60px;
height: 60px;
padding: 0;
}
</style>
from naive-ui.
Related Issues (20)
- 建议表格筛选添加一些新的选项,例如文本输入和条件检索之类的
- 希望增加一个cron表达式组件 HOT 1
- Cascader 组件中的数据在不同分组中 选择会出现混乱 label 和value 一致时 HOT 1
- 希望给NButton增加工具提示属性 HOT 5
- Create dialog without icon HOT 2
- card卡片 属性title与header Slot同时使用header无法显示
- 关于Tree组件的拖拽
- n-tree 组件的TreeOption类型添加泛型
- 支持自定义组件的标签名
- 我觉得可能存在内存溢出的风险。
- 轮播图使用draggable时从左往右滑动时切换异常
- Command palette组件 HOT 1
- 是否会出类似于Lobe UI的这种用于构建 AIGC 网页应用的组件
- Add a horizontal virtual scroll to NDataTable HOT 1
- Cascader组件搜索筛选下拉列表显示不全 HOT 2
- 需求:示例是否可以改成使用Setup语法糖模式,拜托了 HOT 3
- 希望Date Picker组件shortcuts,如果是函数的话,可以吧event返回回来。Hopefully the Date Picker component shortcuts, and if it's a function, you can return the event back! HOT 5
- qrcode 组件的中间icon的image设置跨域 HOT 2
- 组件 transfer 能否增加prop用于自定义头部
- Message内容为纯数字或纯字母的时候不能 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from naive-ui.