Skip to content

Commit

Permalink
Merge pull request #45 from LiuMengBing/release-3.6.8-app
Browse files Browse the repository at this point in the history
commit 完善taro example
  • Loading branch information
likailong180 authored Jul 28, 2023
2 parents 6c64454 + adec90d commit b6d6352
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
20 changes: 18 additions & 2 deletions examples/mini-program-example/src/pages/api/cache/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ export default class Index extends React.Component {
func: () => {
Taro.setStorage({
key: "testKey",
data: "testValue"
data: "testValue",
complete: (res) => {
console.log('setStorage complete ', res)
},
success: (res) => {
console.log('setStorage success ', res)
},
fail: (res) => {
console.log('setStorage fail ', res)
},
})
console.log('setStorage')

},
},
{
Expand All @@ -40,6 +49,9 @@ export default class Index extends React.Component {
id: 'removeStorageSync',
func: () => {
try {
Taro.setStorageSync('testKey','testValue')
console.log('setStorageSync')

Taro.removeStorageSync('testKey')
console.log('removeStorageSync')
} catch (error) {
Expand Down Expand Up @@ -99,6 +111,9 @@ export default class Index extends React.Component {
id: 'clearStorageSync',
func: () => {
try {
Taro.setStorageSync('testKey','testValue')
console.log('setStorageSync')

Taro.clearStorageSync()
console.log('clearStorageSync ')
} catch(e) {
Expand Down Expand Up @@ -127,6 +142,7 @@ export default class Index extends React.Component {
this.state.list.map((item) => {
return (
<Button
key={item.id}
className='api-page-btn'
type='primary'
onClick={item.func == null ? () => {} : item.func}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,18 @@ export default class Index extends React.Component {
{
id: 'previewMedia',
func: () => {
Taro.chooseImage({
Taro.chooseVideo({
success: function (res) {
console.log('chooseMedia success ', res);
Taro.previewMedia({
sources:[{
url:res.tempFilePaths[0],
type:'image',
url:res.tempFilePath,
type:'video',
poster:'test'
}],
current: 1,
showmenu: true,
referrerPolicy: 'origin',
success: function (res) {
console.log('previewMedia success ', res);
},
Expand Down

0 comments on commit b6d6352

Please sign in to comment.