Skip to content

Commit

Permalink
fix(events): add method & component not support events
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Oct 19, 2022
1 parent edbcb87 commit f56b832
Show file tree
Hide file tree
Showing 22 changed files with 158 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-ad-custom-core'
})
export class AdCustom {
export class AdCustom implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 AdCustom 组件!')
notSupport('AdCustom', this)
}

render () {
Expand Down
9 changes: 5 additions & 4 deletions packages/taro-components/src/components/ad/ad.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-ad-core'
})
export class Ad {
export class Ad implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 Ad 组件!')
notSupport('Ad', this)
}

render () {
Expand Down
9 changes: 5 additions & 4 deletions packages/taro-components/src/components/camera/camera.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-camera-core'
})
export class Camera {
export class Camera implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 Camera 组件!')
notSupport('Camera', this)
}

render () {
Expand Down
9 changes: 5 additions & 4 deletions packages/taro-components/src/components/editor/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-editor-core'
})
export class Editor {
export class Editor implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 Editor 组件!')
notSupport('Editor', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-functional-page-navigator-core'
})
export class FunctionalPageNavigator {
export class FunctionalPageNavigator implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 FunctionalPageNavigator 组件!')
notSupport('FunctionalPageNavigator', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-keyboard-accessory-core'
})
export class KeyboardAccessory {
export class KeyboardAccessory implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 KeyboardAccessory 组件!')
notSupport('KeyboardAccessory', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-live-player-core'
})
export class LivePlayer {
export class LivePlayer implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 LivePlayer 组件!')
notSupport('LivePlayer', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-live-pusher-core'
})
export class LivePusher {
export class LivePusher implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 LivePusher 组件!')
notSupport('LivePusher', this)
}

render () {
Expand Down
9 changes: 5 additions & 4 deletions packages/taro-components/src/components/map/map.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-map-core'
})
export class Map {
export class Map implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 Map 组件!')
notSupport('Map', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-match-media-core'
})
export class MatchMedia {
export class MatchMedia implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 MatchMedia 组件!')
notSupport('MatchMedia', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-navigation-bar-core'
})
export class NavigationBar {
export class NavigationBar implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 NavigationBar 组件!')
notSupport('NavigationBar', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-official-account-core'
})
export class OfficialAccount {
export class OfficialAccount implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 OfficialAccount 组件!')
notSupport('OfficialAccount', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-open-data-core'
})
export class OpenData {
export class OpenData implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 OpenData 组件!')
notSupport('OpenData', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-page-container-core'
})
export class PageContainer {
export class PageContainer implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 PageContainer 组件!')
notSupport('PageContainer', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-page-meta-core'
})
export class PageMeta {
export class PageMeta implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 PageMeta 组件!')
notSupport('PageMeta', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-root-portal-core'
})
export class RootPortal {
export class RootPortal implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 RootPortal 组件!')
notSupport('RootPortal', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-share-element-core'
})
export class ShareElement {
export class ShareElement implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 ShareElement 组件!')
notSupport('ShareElement', this)
}

render () {
Expand Down
9 changes: 5 additions & 4 deletions packages/taro-components/src/components/slot/slot.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-slot-core'
})
export class Slot {
export class Slot implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 Slot 组件!')
notSupport('Slot', this)
}

render () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, h, Host } from '@stencil/core'
import { Component, ComponentInterface, h, Host } from '@stencil/core'

import { notSupport } from '../../utils'

@Component({
tag: 'taro-voip-room-core'
})
export class VoipRoom {
export class VoipRoom implements ComponentInterface {
componentDidLoad () {
console.error('H5 暂不支持 VoipRoom 组件!')
notSupport('VoipRoom', this)
}

render () {
Expand Down
12 changes: 12 additions & 0 deletions packages/taro-components/src/utils/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Taro from '@tarojs/taro'

export function notSupport (name = '', instance = {}) {
console.error(`H5 暂不支持 ${name} 组件!`)

Taro.eventCenter.trigger('__taroNotSupport', {
name,
instance,
type: 'component',
category: 'temporarily',
})
}
1 change: 1 addition & 0 deletions packages/taro-components/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export function debounce (fn, ms = 250, scope?) {
}
}

export * from './helper'
export * from './style'
export * from './url'
Loading

0 comments on commit f56b832

Please sign in to comment.