-
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.
- Loading branch information
1 parent
c3086ae
commit ddf279b
Showing
13 changed files
with
724 additions
and
19 deletions.
There are no files selected for viewing
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
70 changes: 70 additions & 0 deletions
70
packages/taro-components-qa/src/components/scroll-view/index.ux
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,70 @@ | ||
<template> | ||
<list | ||
@scroll="onScroll" | ||
@scrollbottom="onScrollToLower" | ||
@scrolltop="onScrollToUpper" | ||
class="{{classname}}" | ||
style="{{style}}" | ||
flex-direction="{{flexDirection}}" | ||
> | ||
<list-item type='a'> | ||
<slot></slot> | ||
</list-item> | ||
</list> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
classname: { | ||
type: String, | ||
required: false, | ||
default: '' | ||
}, | ||
style: { | ||
type: String, | ||
required: false, | ||
default: '' | ||
}, | ||
scrollx: { | ||
type: Boolean, | ||
required: false, | ||
default: true | ||
}, | ||
scrolly: { | ||
type: Boolean, | ||
required: false, | ||
default: false | ||
} | ||
}, | ||
|
||
onInit () { | ||
if (scrolly) { | ||
this.flexDirection = 'column' | ||
} else { | ||
this.flexDirection = 'row' | ||
} | ||
}, | ||
|
||
onScroll () { | ||
this.$emit('scroll', e) | ||
}, | ||
|
||
onScrollToLower() { | ||
this.$emit('scrollToLower', e) | ||
} | ||
|
||
onScrollToUpper () { | ||
this.$emit('scrollToLower', e) | ||
} | ||
|
||
handleClick (e) { | ||
this.$emit('click', e) | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
|
||
</style> | ||
|
42 changes: 42 additions & 0 deletions
42
packages/taro-components-qa/src/components/swiper-item/index.ux
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,42 @@ | ||
<template> | ||
<div | ||
class="{{classname}}" | ||
style="{{style}}" | ||
itemId="{{itemid}}" | ||
onclick="handleClick"> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
classname: { | ||
type: String, | ||
required: false, | ||
default: '' | ||
}, | ||
style: { | ||
type: String, | ||
required: false, | ||
default: '' | ||
}, | ||
itemid: { | ||
type: String, | ||
required: false, | ||
default: '' | ||
} | ||
}, | ||
|
||
onInit () { | ||
}, | ||
handleClick (e) { | ||
this.$emit('click', e) | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
|
||
</style> | ||
|
57 changes: 57 additions & 0 deletions
57
packages/taro-components-qa/src/components/taro-webview/index.ux
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,57 @@ | ||
<template> | ||
<web | ||
class="{{className}}" | ||
style="{{style}}" | ||
onclick="handleClick" | ||
trustedurl="{{trustedurl}}" | ||
allowthirdpartycookies="{{allowthirdpartycookies}}" | ||
> | ||
</web> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
classname: { | ||
type: String, | ||
required: false, | ||
}, | ||
src: { | ||
type: String, | ||
required: false, | ||
default: '' | ||
}, | ||
style: { | ||
type: Object, | ||
required: false, | ||
default: {} | ||
}, | ||
trustedurl: { | ||
type: Array, | ||
required: false, | ||
default: {} | ||
}, | ||
allowthirdpartycookies: { | ||
type: Boolean, | ||
required: false, | ||
default: {} | ||
} | ||
}, | ||
|
||
data: () => ({ | ||
|
||
}), | ||
|
||
onInit () { | ||
|
||
}, | ||
|
||
handleClick (e) { | ||
this.$emit('click', e) | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> | ||
|
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,95 @@ | ||
import contact from '@system.contact' | ||
import sms from '@system.sms' | ||
|
||
export function getContactPick (opts = {}) { | ||
const { success, fail, complete } = opts | ||
const res = { errMsg: 'getContactPick:ok' } | ||
return new Promise((resolve, reject) => { | ||
contact.pick({ | ||
success (data) { | ||
res.result = data | ||
success && success(data) | ||
resolve(res) | ||
}, | ||
fail (data, code) { | ||
res.errMsg = data | ||
res.code = code | ||
fail && fail(res) | ||
complete && complete(res) | ||
reject(res) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export function getContactList (opts = {}) { | ||
const { success, fail, complete } = opts | ||
const res = { errMsg: 'getContactList:ok' } | ||
return new Promise((resolve, reject) => { | ||
contact.list({ | ||
success (data) { | ||
res.result = data | ||
success && success(data) | ||
resolve(res) | ||
}, | ||
fail (data, code) { | ||
res.errMsg = data | ||
res.code = code | ||
fail && fail(res) | ||
complete && complete(res) | ||
reject(res) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export function sendSms (opts = {}) { | ||
const { address, content, success, fail, complete } = opts | ||
const res = { errMsg: 'sendSms:ok' } | ||
return new Promise((resolve, reject) => { | ||
sms.send({ | ||
address, | ||
content, | ||
success (data) { | ||
res.result = data | ||
success && success(data) | ||
resolve(res) | ||
}, | ||
fail (data, code) { | ||
res.errMsg = data | ||
res.code = code | ||
fail && fail(res) | ||
complete && complete(res) | ||
reject(res) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export function readSmsSafely (opts = {}) { | ||
const { timeout, success, fail, complete } = opts | ||
const res = { errMsg: 'sendSms:ok' } | ||
return new Promise((resolve, reject) => { | ||
sms.readSafely({ | ||
timeout, | ||
success (data) { | ||
res.result = data | ||
success && success(data) | ||
resolve(res) | ||
}, | ||
fail (data, code) { | ||
res.errMsg = data | ||
res.code = code | ||
fail && fail(res) | ||
complete && complete(res) | ||
reject(res) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export default { | ||
getContactPick, | ||
getContactList, | ||
sendSms | ||
} |
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,14 @@ | ||
// 未实现 | ||
|
||
// 已实现 api | ||
export * from './request' | ||
export * from './storage' | ||
export * from './router' | ||
export * from './interactive' | ||
export * from './equipment' | ||
export * from './share' | ||
export * from './notification' | ||
export * from './system' | ||
export * from './webview' | ||
export * from './media' | ||
export * from './device' |
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,73 @@ | ||
import audio from '@system.audio' | ||
import record from '@system.record' | ||
|
||
export function createInnerAudioContext () { | ||
return audio | ||
} | ||
|
||
export function getPlayState (opts = {}) { | ||
const { success, fail, complete } = opts | ||
const res = { errMsg: 'getPlayState:ok' } | ||
return new Promise((resolve, reject) => { | ||
device.getCpuInfo({ | ||
success (data) { | ||
res.result = data | ||
success && success(data) | ||
resolve(res) | ||
}, | ||
fail (data, code) { | ||
res.errMsg = data | ||
res.code = code | ||
fail && fail(res) | ||
complete && complete(res) | ||
reject(res) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export function startRecord (opts = {}) { | ||
const { | ||
duration, | ||
sampleRate, | ||
numberOfChannels, | ||
encodeBitRate, | ||
format, | ||
success, | ||
fail, | ||
complete | ||
} = opts | ||
const res = { errMsg: 'startRecord:ok' } | ||
return new Promise((resolve, reject) => { | ||
record.start({ | ||
duration, | ||
sampleRate, | ||
numberOfChannels, | ||
encodeBitRate, | ||
format, | ||
success (data) { | ||
res.result = data | ||
success && success(data) | ||
resolve(res) | ||
}, | ||
fail (data, code) { | ||
res.errMsg = data | ||
res.code = code | ||
fail && fail(res) | ||
complete && complete(res) | ||
reject(res) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export function stopRecord () { | ||
return record.stop() | ||
} | ||
|
||
export default { | ||
createAudioContext, | ||
getPlayState, | ||
startRecord, | ||
stopRecord | ||
} |
Oops, something went wrong.