diff --git a/demo/documentation/components/notification/zhCN/change-content.demo.md b/demo/documentation/components/notification/zhCN/change-content.demo.md index 3235eaed1..249fb436e 100644 --- a/demo/documentation/components/notification/zhCN/change-content.demo.md +++ b/demo/documentation/components/notification/zhCN/change-content.demo.md @@ -1,12 +1,14 @@ # 动态修改内容 你可以修改已经存在的通知 ```html - - 打开它 - - - 改它 - + + + 打开它 + + + 改它 + + ``` ```js import { h, resolveComponent } from 'vue' @@ -15,12 +17,12 @@ export default { inject: ['notification'], data () { return { - notification: null + n: null } }, methods: { open () { - this.notification = this.notification.create({ + this.n = this.notification.create({ title: `Wouldn't it be Nice`, description: 'From the Beach Boys', content: `Wouldn't it be nice if we were older @@ -41,13 +43,13 @@ Hold each other close the whole night through`, src:'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg' }), onClose: () => { - this.notification = null + this.n = null } }) }, change () { - if (this.notification) { - this.notification.content = () => h('img', { + if (this.n) { + this.n.content = () => h('img', { src: 'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg', style: 'width: 100%;' }) @@ -55,9 +57,4 @@ Hold each other close the whole night through`, } } } -``` -```css -.n-button { - margin: 0 12px 8px 0; -} ``` \ No newline at end of file diff --git a/src/_utils/component/datePicker.js b/src/_utils/component/datePicker.js index fba92be91..975890dfa 100644 --- a/src/_utils/component/datePicker.js +++ b/src/_utils/component/datePicker.js @@ -10,7 +10,7 @@ import addDays from 'date-fns/addDays' import getDay from 'date-fns/getDay' import parse from 'date-fns/parse' import format from 'date-fns/format' -import { KEY_CODE } from '../event/keyCode' +import { KEY_CODE } from '../dom/key-code' function getDerivedTimeFromKeyboardEvent (prevValue, event) { const now = getTime(Date.now()) diff --git a/src/_utils/delegate/keyboardDelegate.js b/src/_utils/delegate/keyboardDelegate.js index 5ae94286a..cc4d6268e 100644 --- a/src/_utils/delegate/keyboardDelegate.js +++ b/src/_utils/delegate/keyboardDelegate.js @@ -1,4 +1,4 @@ -import { KEY_CODE } from '../event/keyCode' +import { KEY_CODE } from '../dom/key-code' class KeyboardDelegate { constructor () { diff --git a/src/_utils/dom/index.js b/src/_utils/dom/index.js new file mode 100644 index 000000000..98d0c4e18 --- /dev/null +++ b/src/_utils/dom/index.js @@ -0,0 +1 @@ +export { KEY_CODE } from './key-code' diff --git a/src/_utils/event/keyCode.js b/src/_utils/dom/key-code.js similarity index 100% rename from src/_utils/event/keyCode.js rename to src/_utils/dom/key-code.js diff --git a/src/_utils/index.js b/src/_utils/index.js new file mode 100644 index 000000000..ac76a8c4e --- /dev/null +++ b/src/_utils/index.js @@ -0,0 +1,26 @@ +export { + call, + keep, + omit, + createId, + getVNodeChildren, + render +} from './vue' +export { + warn, + warnOnce, + debug +} from './naive' +export { + pxfy, + depx, + formatLength +} from './css' +export * from './composition' +export { + nextFrame, + isIos +} from './misc' +export { + KEY_CODE +} from './dom' diff --git a/src/_utils/browser/os.js b/src/_utils/misc/os.js similarity index 100% rename from src/_utils/browser/os.js rename to src/_utils/misc/os.js diff --git a/src/date-picker/src/panel/commonCalendarMixin.js b/src/date-picker/src/panel/commonCalendarMixin.js index d873d914e..db007d28d 100644 --- a/src/date-picker/src/panel/commonCalendarMixin.js +++ b/src/date-picker/src/panel/commonCalendarMixin.js @@ -3,7 +3,7 @@ import { locale } from '../../../_mixins' import keyboardDelegate from '../../../_utils/delegate/keyboardDelegate' -import { KEY_CODE } from '../../../_utils/event/keyCode' +import { KEY_CODE } from '../../../_utils' const TIME_CONST = { hours: ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'], diff --git a/src/dropdown/src/Dropdown.js b/src/dropdown/src/Dropdown.js index c71b8c2e7..d9bf12226 100644 --- a/src/dropdown/src/Dropdown.js +++ b/src/dropdown/src/Dropdown.js @@ -5,7 +5,7 @@ import { themeable, usecssr } from '../../_mixins' -import { KEY_CODE } from '../../_utils/event/keyCode' +import { KEY_CODE } from '../../_utils' import keyboardDelegate from '../../_utils/delegate/keyboardDelegate' import NPopover from '../../popover' import NDropdownMenu from './DropdownMenu.js' diff --git a/src/scrollbar/src/ScrollBar.vue b/src/scrollbar/src/ScrollBar.vue index 9494ffc56..61341617d 100644 --- a/src/scrollbar/src/ScrollBar.vue +++ b/src/scrollbar/src/ScrollBar.vue @@ -88,7 +88,7 @@ import themable from '../../_mixins/themeable' import resizeObserverDelagate from '../../_utils/delegate/resizeObserverDelegate' import usecssr from '../../_mixins/usecssr' import styles from './styles/index.js' -import { isIos } from '../../_utils/browser/os' +import { isIos } from '../../_utils' export default { name: 'Scrollbar', diff --git a/src/time-picker/src/TimePicker.vue b/src/time-picker/src/TimePicker.vue index 2284bdeb5..e11815c1e 100644 --- a/src/time-picker/src/TimePicker.vue +++ b/src/time-picker/src/TimePicker.vue @@ -203,7 +203,7 @@ import getHours from 'date-fns/getHours' import getSeconds from 'date-fns/getSeconds' import { strictParse } from '../../_utils/component/datePicker' import keyboardDelegate from '../../_utils/delegate/keyboardDelegate' -import { KEY_CODE } from '../../_utils/event/keyCode' +import { KEY_CODE } from '../../_utils' import NBaseFocusDetector from '../../_base/focus-detector' import TimeIcon from '../../_icons/time-outline.vue' import styles from './styles'