naive-ui/vue3.md

484 lines
14 KiB
Markdown
Raw Normal View History

2020-11-05 15:24:18 +08:00
# Migrate from V1
2020-12-14 02:43:48 +08:00
2020-11-05 15:24:18 +08:00
## General Breaking Changes
2020-12-14 02:43:48 +08:00
2020-11-05 14:54:47 +08:00
- css
- css index `naive-ui/lib|es/styles/index.css` has been removed, do not import it any more!
- fonts
2021-02-18 22:37:19 +08:00
- `naive-ui/lib|es/styles/fonts/*` has been removed, use [vfonts](https://www.npmjs.com/package/vfonts)
2020-11-05 14:54:47 +08:00
- icons
2021-02-18 22:37:19 +08:00
- `naive-ui/lib|es/icons/*` is deprecated (vue-loader is required), use [xicons](https://github.com/07akioni/xicons) instead.
2021-02-03 00:48:31 +08:00
- `n-nimbus-icon` is moved to `naive-ui/compat/nimbus-icon` (vue-loader is required)
2020-11-05 14:54:47 +08:00
- `n-nimbus-form-card` is removed
- locale & theme on `n-config-provider` doesn't accept string any more (not it accepts object).
2020-09-10 14:18:02 +08:00
2020-11-05 15:24:18 +08:00
## Components
2020-12-14 02:43:48 +08:00
2020-11-05 15:24:18 +08:00
- [x] form
- form-item
2020-11-05 14:54:47 +08:00
- new
2020-11-05 15:24:18 +08:00
- `show-feedback` prop
- [x] affix
- deprecate
- `target` => `listen-to`
- [x] alert
- [x] anchor
2021-02-27 13:35:59 +08:00
- new
- `show-rail` props
- `show-background` props
2020-11-05 15:24:18 +08:00
- deprecate
- `target` => `listen-to`
- [x] auto-complete
- break
- `v-model` => `v-model:value`
- deprecate
- `on-input` => `on-update:value`
- new
- `on-blur`
- `on-focus`
- [x] avatar
- [x] back-top
- new
- `show` controlled show
- `on-update:show`
- `to` teleport target
- deprecate
- `on-show` => `on-update:show`
- `on-hide` => `on-update:show`
- `target` => `listen-to`
- [x] badge
- [x] breadcrumb
- [x] button
- [x] button-group
- [x] card
- [x] cascader
- break
- `v-model` => `v-model:value`
- `on-load` has different usage
- `leaf-only` has different meaning
- new
- `cascade` prop
- `show-path` prop
2020-12-14 02:43:48 +08:00
- `default-value` prop
2020-11-05 15:24:18 +08:00
- deprecated
- `on-change` => `on-update:value`
- [x] checkbox
- checkbox
- break
2020-11-05 15:24:18 +08:00
- `value` only supports `string`
- deprecate
2020-11-05 15:24:18 +08:00
- `on-change` => `on-update:checked`
- new
2020-11-05 15:24:18 +08:00
- `default-checked` prop
- checkbox-group
2020-11-05 14:54:47 +08:00
- break
2020-11-05 15:24:18 +08:00
- `value` only supports `string` or `null`
2020-09-28 14:18:14 +08:00
- deprecate
- `on-change` => `on-update:value`
2020-11-05 15:24:18 +08:00
- [x] code
- [x] collapse
- deprecate
- `on-expanded-names-change` => `on-update:expanded-names`
- removed
- `v-model` => `v-model:expanded-names`
2021-02-02 12:29:52 +08:00
- [x] config-consumer (deprecated)
2020-11-05 15:24:18 +08:00
- [x] config-provider
- break
- `theme` use new theme from naive export
2020-11-05 15:24:18 +08:00
- `$NOs.theme` => `useOsTheme`
2021-01-04 01:03:09 +08:00
- `theme` => `legacy-theme`
2020-11-05 15:24:18 +08:00
- deprecate
- `as` => `tag`
- `styleScheme` won't working in next version
- new
2021-02-02 12:24:48 +08:00
- `date-locale` prop
- `locale` prop
2020-11-05 15:24:18 +08:00
- provide `useOsTheme` hook
- [x] confirm => `dialog`
- break
- rename `confirm` to `dialog`
- remove
2021-02-05 18:28:34 +08:00
- `$NConfirm`, `$NModal` => `useDialog`
2020-11-05 15:24:18 +08:00
- [x] data-table
- deprecate
- `on-filters-change` => `on-update:filters`
- `on-sorter-change` => `on-update:sorter`
- `on-checked-row-keys-change` => `on-update:checked-row-keys`
- `on-page-change` => `on-update:page`
- `on-page-size-change` => `on-update:page-size`
- [x] date-picker
- break
- `v-model` => `v-model:value`
- deprecate
- `on-change` => `on-update:value`
2020-12-14 03:34:36 +08:00
- new
- `default-value` prop
2020-11-05 15:24:18 +08:00
- [x] descriptions
- [x] divider
- [x] drawer
- break
- `v-model`
- deprecate
- `on-show` => `on-update:show`
- `on-hide` => `on-update:show`
- `target` => `to`
2020-12-15 16:24:39 +08:00
- `drawer-class` => `class`
- `drawer-style` => `style`
2020-11-05 15:24:18 +08:00
- new
- `display-directive` prop
- [x] dropdown
- break
- `option.value` => `option.key`
- item must have unique key
- submenu must have unique key
- remove
- `submenu-width`
- `submenu-min-width`
- `submenu-max-width`
- new
- `option.icon`
- [x] dynamic-input
- break
- `v-model` => `v-model:value`
- `on-clear` is removed
2020-11-05 15:24:18 +08:00
- deprecate
- `on-input` => `on-update:value`
- new
- `item-style` prop
- `min` prop
- `default-value` prop
2020-11-05 15:24:18 +08:00
- [x] dynamic-tags
- break
- `v-model` => `v-model:value`
- [x] element
- [x] empty
- [x] gradient-text
- [x] grid
- [x] icon
- [x] input
- break
- `v-model` => `v-model:value`
- new
2020-12-14 03:47:21 +08:00
- `on-update:value` prop
- `default-value` prop
2020-11-05 15:24:18 +08:00
- [x] input-group
- [x] input-group-label
- [x] input-number
- deprecate
- `on-change` => `on-update:value`
2020-12-14 02:43:48 +08:00
- new
- `default-value` prop
2020-11-05 15:24:18 +08:00
- [x] layout
- layout-content, layout
2020-12-14 02:43:48 +08:00
- breaking `use-native-scrollbar` => `native-scrollbar`
2020-11-05 15:24:18 +08:00
- layout-sider
2020-12-14 02:43:48 +08:00
- breaking `use-native-scrollbar` => `native-scrollbar`
2020-09-27 03:21:50 +08:00
- deprecate
2020-11-05 15:24:18 +08:00
- `on-expand` => `on-update:collapsed`
- `on-collapse` => `on-update:collapsed`
- [x] list
- [x] loading-bar
- remove
- `$NLoadingBar`
- new
2021-02-05 18:28:34 +08:00
- `useLoadingBar`
2020-11-05 15:24:18 +08:00
- `n-loading-bar-provider`
- [x] log
- deprecate
- `scrollToTop` => `scrollTo`
- `scrollToBottom` => `scrollTo`
- [x] menu
- deprecate
- `on-expanded-names-change` => `on-update:expanded-keys`
- `on-select` => `on-update:value`
- `expanded-names` => `expanded-keys`
- `default-expanded-names` => `default-expanded-keys`
- `item.name` => `item.key`
- remove
- `item.titleExtra`
2020-11-05 15:24:18 +08:00
- `overlay-width`
- `overlay-min-width`
- [x] message
- rewrite message using `n-message-provider`
2021-02-05 18:28:34 +08:00
- new
- `useMessage`
2020-11-05 15:24:18 +08:00
- deprecate
- `onHide` => `onLeave`
- `onAfterHide` => `onAfterLeave`
- remove
- `message.hide` => `message.destroy`
- [x] modal
- rewrite with teleport
- new
- `display-directive`
- deprecate
- `v-model`
- `on-show` => `on-update:show`
- `on-hide` => `on-update:show`
2020-12-15 16:24:39 +08:00
- `overlay-style` => `style`
2020-11-05 15:24:18 +08:00
- remove
- default hide behavior for preset
- [x] notification
2021-02-05 18:28:34 +08:00
- new
- `useNotification`
2020-11-05 15:24:18 +08:00
- deprecate
- `open` => `create`
- `onHide` => `onLeave`
- `onAfterShow` => `onAfterEnter`
- `onAfterHide` => `onAfterHide`
- [x] pagination
- deprecate
- `on-change` => `on-update:page`
- `on-page-size-change` => `on-update:page-size`
- [x] popconfirm
- [x] popover
- new
- `default-show`
2021-02-19 01:27:35 +08:00
- `overlap`
2020-11-05 15:24:18 +08:00
- deprecate
2020-12-16 02:24:35 +08:00
- `#activator` => `#trigger`
2020-11-05 15:24:18 +08:00
- `overlay-xxx` => `body-xxx`
- remove
- `controller`
- `max-width`
- `width`
- `min-width`
- `manual` trigger is removed, use `show` to controll the popover
- `body-class`, use `class` instead
- `body-style`, use `style` instead
2020-11-05 15:24:18 +08:00
- [x] popselect
- break
- `v-model` => `v-model:value`
- deprecate
- `on-change` => `on-update:value`
- [x] progress
- [x] radio
- radio-group
2020-11-05 14:54:47 +08:00
- break
2020-11-05 15:24:18 +08:00
- default `size` `'small'` => `'medium'`
- value only supports `string` or `null`
2020-09-29 00:56:27 +08:00
- deprecate
- `on-change` => `on-update:value`
2020-11-05 15:24:18 +08:00
- radio & radio-button
2020-11-05 14:54:47 +08:00
- break
2020-11-05 15:24:18 +08:00
- value only supports `string`
- `checked-value` => `checked`
- It is change to conform html standard usage
- `on-change` => `on-update:checked`
- `on-change` is now a native event
- [x] result
- [x] scrollbar
- [x] select
- break
- `v-model` => `v-model:value`
- `on-scroll(event, container, content)` => `on-scroll(event)`
- `option.render(h, data)` => `option.render(data)`
- deprecated
- `on-change` => `on-update:value`
- [x] slider
- deprecated
- `on-change` => `on-update:value`
2020-12-14 02:43:48 +08:00
- new
- `default-value` prop
2020-11-05 15:24:18 +08:00
- bug
- vue refs https://github.com/vuejs/vue-next/issues/2283
- drag logic
- [x] space
- [x] spin
- breaking
- `'in-small'`, `'in-medium'` and `'in-large'` size are removed
- deprecate
- `spinning` => `show`
2020-11-05 15:24:18 +08:00
- [x] statistic
- [x] steps
- [x] switch
- remove
- `value` => `value`
- `change` => `on-update:value`
- [x] table
- [x] tabs
- deprecate
- `active-name` => `value`
- `on-active-name-change` => `on-update:value`
- [x] tag
- break
- `v-model` => `v-model:value`
- deprecate
- `on-checked-change` => `on-update:checked`
- [x] thing
- [x] time
- break
- `type` default from `'relative'` to `'date-time'`
2020-11-05 15:24:18 +08:00
- [x] time-picker
- break
- `v-model` => `v-model:value`
- [x] timeline
- [x] tooltip
2020-12-16 02:24:35 +08:00
- deprecate
- `#activator` => `#trigger`
2020-11-05 15:24:18 +08:00
- [x] transfer
- break
- `v-model` => `v-model:value`
- deprecate
- `on-change` => `on-update:value`
2020-12-14 03:14:45 +08:00
- new
- `default-value` prop
2020-11-05 15:24:18 +08:00
- [x] tree
- break
- `v-model` => `v-model:selected-keys`
- deprecate
- `on-selected-keys-change` => `on-update:selected-keys`
- `on-checked-keys-change` => `on-update:checked-keys`
- `on-expanded-keys-change` => `on-update:expanded-keys`
- [x] typography
2020-11-07 01:02:26 +08:00
- breaking
- text, p
- `depth` from `primary` ... `tertiary` => `1`, `2`, `3`
2020-11-05 15:24:18 +08:00
- deprecate
- text
- `as` => `tag`
- [x] upload
- [x] nimbus-service-layout
2020-12-14 02:43:48 +08:00
- breaking
- `v-model` => `v-model:value`
2020-11-02 21:41:40 +08:00
2020-11-05 15:24:18 +08:00
- TODO
- [x] vooks
- [x] icons from `vicons`
- [x] fonts from `vfonts`
- [x] vite-build
- [x] rollup-build
2020-12-14 02:43:48 +08:00
- [x] wait for new version of rollup-plugin-vue, https://github.com/vuejs/rollup-plugin-vue/issues/408
2020-11-05 15:24:18 +08:00
- tusimple theme
- [x] clean delegate
2020-11-05 15:24:18 +08:00
- [x] site production tag (bug)
- [x] demo scrollbar 的问题
- [x] table x scroll 右侧阴影不消失
- [x] log scrollTo 有点问题
- [x] remove hollowoutable
2020-11-14 20:38:30 +08:00
- [x] styleScheme, css variables 组件
- 文档之后再说
2020-12-14 02:43:48 +08:00
- [x] use-global-style ? 感觉效果不会特别好而且还是很无谓的性能开销这个问题可以之后再思考,现阶段 vue 的写法还是全局 install
2020-11-07 00:22:09 +08:00
- [x] dynamic-input, no value
2020-11-14 20:38:30 +08:00
- [x] button, input 的 css 变量名需要修改一下
2020-11-11 23:10:58 +08:00
- [x] test rollup treeshaking
- [x] test webpack treeshaking
2020-11-14 20:38:30 +08:00
- [x] menu utils render
- [x] dialog bug
- [x] data-table css vars
- [x] typography css vars
- [x] spin css vars
- [x] radio css vars
- [x] checkbox css vars
- [x] avatar css vars
- [x] landing page icon
- [x] switch styles
- [x] slider styles
- [x] drawer api
- [x] chrome date-picker overflow (focus({ preventScroll }))
- [x] slider 键盘好像会激活不该激活的 tooltip...
2020-12-07 17:21:23 +08:00
- [x] transfer 打包之后有问题
- [x] side effects = false 好像会影响 rollup 的打包(这让我很不安,要是生效 css 怎么办?要是不生效 JS 怎么办?)(事实上确实会影响网站对于 fonts 的打包,只能先靠脚本凑活一下) https://github.com/rollup/plugins/issues/692
2020-12-07 17:21:23 +08:00
- [x] vue 在 $attrs 的处理上 dev 和 prod 还是有差别 https://github.com/vuejs/vue-next/issues/2741
2021-02-04 13:10:27 +08:00
- [x] date-picker input 的 clear 有时候不会清除,看起来是 vue 的 bug
- https://github.com/vuejs/vue-next/issues/2768
2021-02-04 13:10:27 +08:00
- [x] radio-group 影响主题切换,看起来是 vue 的 bug
- https://github.com/vuejs/vue-next/issues/2829
- [x] cascader demo async 切换未重置数据demo 写的有问题
- [x] gradient-text transition 又没了
2021-01-04 01:03:09 +08:00
- [x] md-loader code
2021-01-11 23:47:00 +08:00
- [x] input + form-item style
2021-01-10 14:25:21 +08:00
- [x] loadingbar theme
- [x] dropdown group + menu use dropdown
- [x] 多行 message
2021-02-03 11:47:57 +08:00
- [x] progress height
- [x] close 重构
2021-02-03 16:39:00 +08:00
- [x] data-table, radio style 重构
- [x] message icon style
2021-01-12 01:31:29 +08:00
- [x] transfer search icon style
- [x] base selection icon style
2021-01-11 23:17:25 +08:00
- [x] date picker not working
2021-01-11 00:37:40 +08:00
- [x] avatar font size bug
- [x] handle global style
- 暂时放在 useTheme + useStyle 中... 似乎没啥太好的办法,最终还是要想办法让样式不要溢出
- [x] select menu padding top & bottom
- [x] time-picker invalid
2021-01-11 23:17:25 +08:00
- [x] date-picker invalid
- [x] vooks `useNow`
2021-01-12 01:56:01 +08:00
- [x] treemate activePath includeGroup: false
- [x] 拆分 dateFns locale => dateLocale
2021-01-12 19:58:41 +08:00
- [x] 试图把组件的 demo 放到 src 里面
- [x] 去掉仅存的 mixin
- [x] form item default type explain
- [x] selection focus style
- [x] refactor site use store!!! singleton
2021-02-01 13:31:09 +08:00
- [x] 文档网站主题切换
2021-02-02 13:11:34 +08:00
- [x] 文档网站 demo 样式
2021-02-01 13:31:09 +08:00
- [x] anchor bug
- [x] getKey select & autocomplete type safe & input event interface? onInput value | null or value
2021-02-01 13:31:09 +08:00
- [x] vshow (maybe create a vue pr)
- [x] jsx focusin out (waiting for vue update)
2021-02-01 15:45:53 +08:00
- [x] inject key & value in type (I should use InjectionKey...)
- [x] form item no label css
2021-02-01 13:31:09 +08:00
- [x] unify treemate ignored
2021-02-03 16:05:54 +08:00
- [x] fix menu extra
2021-02-03 00:48:31 +08:00
- [x] build icon
- [x] compat
- [x] fix upload dragger
2021-02-02 23:12:58 +08:00
- [x] fix table sorter
- [x] tree 多选节点第二个 demo
- [x] table treemate!!!
- [x] createTheme
2021-02-03 21:38:43 +08:00
- [x] build site
2021-02-04 13:10:27 +08:00
- [x] table fixed col
- [ ] prefixCls暂时不需要
- [x] 更新一波文档 props
- [x] 更新样式的文档
2021-02-04 13:10:27 +08:00
- [ ] on update value api
- [x] anchor in modal page, maybe a bug of vue...
2021-02-04 13:10:27 +08:00
- [ ] menu + dropdown collapsed 时候 menu item 不更新selected 从使用 useMemo 切换成 computed性能下降, Vue 在这种时候一定存在 bug但是暂时没空找了...
- [ ] select menu multiple, when show=true, checkmark transiton not working推测是 vue 的 bug
2021-02-05 15:09:38 +08:00
- [ ] demo hmr (或许是 vite-plugin-vue 或 vite 的 bug修改内容不更新
2021-02-14 00:52:22 +08:00
- [x] 不再提前编译 demo 的 highlight code应该可以缩小很多打包体积
- [x] fix input textarea clear...
- [x] input auto size
- [x] data table custom render sorter
- [x] upload retry
2021-02-14 20:57:48 +08:00
- [x] table bottom-bordered
2021-02-14 00:52:22 +08:00
- [x] data table filter menu
- [x] popover default trigger
2021-02-17 19:40:12 +08:00
- [x] select option type
2021-03-21 14:57:07 +08:00
- [x] <del>popover after enter 之后关闭再生效</del> 把 duration 和 delay 弄小点,而且里面事件处理器其实写的有问题
- [x] popover width
- [ ] selection popover 滚动
- [x] card 设定高度
2021-03-24 01:35:17 +08:00
- [x] dropdown 手动定位有 bugmousemoveoutside
2021-03-27 12:06:08 +08:00
- [x] select menu loading
- [x] refactor layout to make position work on first shot
- [x] <del>mention mention pending option not correct, sometimes it is not the first option</del> In fact it's caused by mouse hover on item...
- [x] code Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated.
- [x] vdirs zindexable https://github.com/vuejs/vue-next/issues/3497
2021-04-05 18:11:19 +08:00
- [x] collapse-item overflow
2021-04-05 22:57:19 +08:00
- [x] anchor ignore gap 有 bug
2021-04-05 20:06:50 +08:00
- [x] popover click 移动端不生效
2021-04-05 18:11:19 +08:00
- [ ] menu path 对应的问题
- [x] debug anchor 删除无用 link
- [x] popover inst methods
- [x] ios 浏览器 demo code font size 不对
- [x] <del>table overflow bordered</del>
- [x] table ellipisis vertical align
- [x] form item grid item
- [x] select filter composite...
- [ ] 清理导出的 select 类型
2021-02-03 01:45:56 +08:00
## Build
2021-02-03 20:20:00 +08:00
package: tsx => es|lib => terse cssr => replace global vars => release
site: build package => move to node_modules => setup side effects => vite build => release
2020-11-05 15:24:18 +08:00
## Info
2020-12-14 02:43:48 +08:00
https://github.com/vuejs/vue-next/issues/2549 last cherry-picked commit: 6560ae34d71b81d584af79f810cb9dfa87119d1a