-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13295 from AdvancedCat/feat/channel-video
feat(weapp): 新增对 ChannelVideo 组件的支持
- Loading branch information
Showing
34 changed files
with
442 additions
and
18 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/taro-components-react/src/components/channel-live/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './loader' | ||
|
||
export { ChannelLive as default } from '@tarojs/components/lib/react' |
3 changes: 3 additions & 0 deletions
3
packages/taro-components-react/src/components/channel-live/loader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineCustomElement } from '@tarojs/components/dist/components/taro-channel-live-core' | ||
|
||
defineCustomElement() |
3 changes: 3 additions & 0 deletions
3
packages/taro-components-react/src/components/channel-video/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './loader' | ||
|
||
export { ChannelVideo as default } from '@tarojs/components/lib/react' |
3 changes: 3 additions & 0 deletions
3
packages/taro-components-react/src/components/channel-video/loader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineCustomElement } from '@tarojs/components/dist/components/taro-channel-video-core' | ||
|
||
defineCustomElement() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { h } from '@stencil/core' | ||
import { newSpecPage, SpecPage } from '@stencil/core/testing' | ||
|
||
import { ChannelLive } from '../src/components/channel-live/channel-live' | ||
import { printUnimplementedWarning } from './utils' | ||
|
||
const logError = jest.fn() | ||
console.error = logError | ||
|
||
describe('ChannelLive', () => { | ||
let page: SpecPage | ||
|
||
it('unimplemented', async () => { | ||
page = await newSpecPage({ | ||
components: [ChannelLive], | ||
template: () => (<taro-channel-live-core />), | ||
}) | ||
await page.waitForChanges() | ||
|
||
expect(page.root).toEqualHtml(` | ||
<taro-channel-live-core></taro-channel-live-core> | ||
`) | ||
expect(logError).toHaveBeenCalledWith(printUnimplementedWarning(page.root)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { h } from '@stencil/core' | ||
import { newSpecPage, SpecPage } from '@stencil/core/testing' | ||
|
||
import { ChannelVideo } from '../src/components/channel-video/channel-video' | ||
import { printUnimplementedWarning } from './utils' | ||
|
||
const logError = jest.fn() | ||
console.error = logError | ||
|
||
describe('ChannelVideo', () => { | ||
let page: SpecPage | ||
|
||
it('unimplemented', async () => { | ||
page = await newSpecPage({ | ||
components: [ChannelVideo], | ||
template: () => (<taro-channel-video-core />), | ||
}) | ||
await page.waitForChanges() | ||
|
||
expect(page.root).toEqualHtml(` | ||
<taro-channel-video-core></taro-channel-video-core> | ||
`) | ||
expect(logError).toHaveBeenCalledWith(printUnimplementedWarning(page.root)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/taro-components/src/components/channel-live/channel-live.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component, ComponentInterface, h, Host } from '@stencil/core' | ||
|
||
import { notSupport } from '../../utils' | ||
|
||
@Component({ | ||
tag: 'taro-channel-live-core' | ||
}) | ||
export class ChannelLive implements ComponentInterface { | ||
componentDidLoad () { | ||
notSupport('ChannelLive', this) | ||
} | ||
|
||
render () { | ||
return ( | ||
<Host /> | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/taro-components/src/components/channel-live/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# taro-channel-live-core | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
18 changes: 18 additions & 0 deletions
18
packages/taro-components/src/components/channel-video/channel-video.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component, ComponentInterface, h, Host } from '@stencil/core' | ||
|
||
import { notSupport } from '../../utils' | ||
|
||
@Component({ | ||
tag: 'taro-channel-video-core' | ||
}) | ||
export class ChannelVideo implements ComponentInterface { | ||
componentDidLoad () { | ||
notSupport('ChannelVideo', this) | ||
} | ||
|
||
render () { | ||
return ( | ||
<Host /> | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/taro-components/src/components/channel-video/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# taro-channel-video-core | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ComponentType } from 'react' | ||
import { StandardProps, CommonEventFunction } from './common' | ||
interface ChannelVideoProps extends StandardProps { | ||
/** 视频 feedId | ||
* @supported weapp | ||
*/ | ||
feedId: string | ||
|
||
/** 视频号 id,以“sph”开头的id,可在视频号助手获取。视频号必须与当前小程序相同主体。 | ||
* @supported weapp | ||
*/ | ||
finderUserName: string | ||
/** 是否循环播放 | ||
* @supported weapp | ||
* @default false | ||
*/ | ||
loop?: boolean | ||
|
||
/** 是否静音播放 | ||
* @supported weapp | ||
* @default false | ||
*/ | ||
muted?: boolean | ||
|
||
/** 当视频大小与 video 容器大小不一致时,视频的表现形式 | ||
* @supported weapp | ||
* @default "contain" | ||
*/ | ||
objectFit?: 'fill' | 'contain' | 'cover' | ||
|
||
/** 是否自动播放 | ||
* @supported weapp | ||
* @default false | ||
*/ | ||
autoplay?: boolean | ||
|
||
/** 视频播放出错时触发 | ||
* @supported weapp | ||
*/ | ||
onError?: CommonEventFunction | ||
} | ||
|
||
/** | ||
* 小程序内嵌视频号视频组件,支持在小程序中播放视频号视频,并无弹窗跳转至视频号。注意:使用该组件打开的视频号视频需要与小程序相同主体或关联主体。 | ||
* @classification media | ||
* @supported weapp | ||
* @see https://developers.weixin.qq.com/miniprogram/dev/component/channel-video.html | ||
*/ | ||
declare const ChannelVideo: ComponentType<ChannelVideoProps> | ||
export { ChannelVideo, ChannelVideoProps } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.