array demo
This commit is contained in:
parent
9010489037
commit
4cb3badb4d
@ -8,7 +8,9 @@ import { BaseLocalStorage, ScreenUtil } from '@devwiki/base';
|
||||
import { HomeItem, HomeItemGroup } from '../model/Home';
|
||||
import { MyApp } from '../MyApp';
|
||||
|
||||
import('./animation/LoadingPage')
|
||||
import './animation/LoadingPage'
|
||||
import './animation/ScaleRotatePage'
|
||||
import { PageName } from './PageName';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -47,6 +49,7 @@ struct Index {
|
||||
items: [
|
||||
{ name: 'CompTransition', page: 'pages/animation/CompTransitionPage'},
|
||||
{ name: 'Loading', page: 'pages/animation/LoadingPage'},
|
||||
{ name: 'ScaleRotatePage', page: PageName.ScaleRotatePage },
|
||||
]
|
||||
},
|
||||
// 多媒体
|
||||
@ -62,6 +65,7 @@ struct Index {
|
||||
items: [
|
||||
{name: "Scheme", page: 'pages/system/SchemePage'},
|
||||
{name: "MVVM", page: 'pages/mvvm/HomePage'},
|
||||
{name: "ArrayBind", page: 'pages/mvvm/ArrayBindPage'},
|
||||
{name: "SetLanguage", page: 'pages/system/SetLanguagePage'}
|
||||
]
|
||||
},
|
||||
@ -150,7 +154,11 @@ struct Index {
|
||||
Divider().margin({ top: 2 });
|
||||
}.onClick(() => {
|
||||
if (item.page) {
|
||||
if (item.page.startsWith('pages/')) {
|
||||
this.getUIContext().getRouter().pushUrl({url: item.page })
|
||||
} else {
|
||||
this.getUIContext().getRouter().pushNamedRoute({name: item.page })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
5
app/src/main/ets/pages/PageName.ets
Normal file
5
app/src/main/ets/pages/PageName.ets
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
export enum PageName {
|
||||
|
||||
ScaleRotatePage = 'animation/ScaleRotatePage'
|
||||
}
|
67
app/src/main/ets/pages/animation/ScaleRotatePage.ets
Normal file
67
app/src/main/ets/pages/animation/ScaleRotatePage.ets
Normal file
@ -0,0 +1,67 @@
|
||||
import { PageName } from '../PageName';
|
||||
|
||||
@Component
|
||||
@Entry({routeName: PageName.ScaleRotatePage})
|
||||
struct ScaleRotatePage {
|
||||
|
||||
@State orderId:string = ''
|
||||
@State rootJustifyContent: FlexAlign = FlexAlign.Start
|
||||
|
||||
@State showQRAnimation: boolean= false
|
||||
@State qrColumnHeight: Length = ''
|
||||
@State qrJustifyContent: FlexAlign = FlexAlign.Start
|
||||
|
||||
@State showBarcodeAnimation : boolean = false;
|
||||
@State barcodeHeight: Length = ''
|
||||
@State barcodeAngle: number = 0
|
||||
|
||||
@Builder
|
||||
ScanBarCodeDialog(){
|
||||
|
||||
}
|
||||
|
||||
private ScanBarCodeDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: this.ScanBarCodeDialog,
|
||||
autoCancel: true,
|
||||
alignment: DialogAlignment.Center,
|
||||
customStyle: true,
|
||||
openAnimation: {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
build() {
|
||||
|
||||
Column(){
|
||||
Text('Title')
|
||||
|
||||
Column(){
|
||||
Image($r('app.media.ic_eye_off')).width(200).height(200).onClick(() =>{
|
||||
|
||||
})
|
||||
Text('Order Id:' + this.orderId).visibility(this.showQRAnimation ? Visibility.Visible : Visibility.None)
|
||||
}.width('100%').visibility(this.showBarcodeAnimation ? Visibility.None : Visibility.Visible)
|
||||
.animation({
|
||||
duration: 1000
|
||||
})
|
||||
|
||||
Text('Order Id:' + this.orderId).visibility(this.showQRAnimation || this.showBarcodeAnimation ? Visibility.None : Visibility.Visible)
|
||||
|
||||
Column(){
|
||||
|
||||
Text('Order Id:' + this.orderId).visibility(this.showBarcodeAnimation ? Visibility.Visible : Visibility.None)
|
||||
|
||||
Image($r('app.media.ic_eye_off')).width(400).height(100).onClick(() =>{
|
||||
})
|
||||
}.visibility(this.showQRAnimation ? Visibility.None : Visibility.Visible)
|
||||
.rotate({ centerX: '50%', centerY: '50%', angle: this.barcodeAngle})
|
||||
.animation({
|
||||
duration: 1000
|
||||
})
|
||||
|
||||
|
||||
}.width('100%').height('100%').alignItems(HorizontalAlign.Center).justifyContent(this.rootJustifyContent)
|
||||
}
|
||||
|
||||
|
||||
}
|
25
app/src/main/ets/pages/mvvm/ArrayBindPage.ets
Normal file
25
app/src/main/ets/pages/mvvm/ArrayBindPage.ets
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
export struct ArrayBindPage {
|
||||
|
||||
@State firstDatas: string[] = ["1"];
|
||||
@State secondDatas: string[] = ["2"]
|
||||
|
||||
build() {
|
||||
Column(){
|
||||
|
||||
Text(this.firstDatas[0]);
|
||||
Text(this.secondDatas[0]).margin({top: 16})
|
||||
Button("Change").margin({top: 16}).onClick(() => {
|
||||
let first = this.firstDatas;
|
||||
this.changeFirstIndex(first);
|
||||
this.changeFirstIndex(this.secondDatas);
|
||||
})
|
||||
}.width('100%').height('100%')
|
||||
}
|
||||
|
||||
changeFirstIndex(datas: string[]) {
|
||||
datas[0] = '111'
|
||||
}
|
||||
}
|
@ -3,6 +3,8 @@ import { Log } from '@devwiki/base/Index';
|
||||
import { APIError, APIHeader, APIQuery, APIRequestMethod, Organization } from './APIModel';
|
||||
import { APIRequest } from './APIModel';
|
||||
import { APIResult } from './APIModel';
|
||||
import axios from '@ohos/axios';
|
||||
import { Axios } from '@ohos/axios';
|
||||
|
||||
const TAG = '[RestAPI]'
|
||||
|
||||
|
33
app/src/main/ets/utils/PasteboardUtil.ets
Normal file
33
app/src/main/ets/utils/PasteboardUtil.ets
Normal file
@ -0,0 +1,33 @@
|
||||
import { pasteboard } from '@kit.BasicServicesKit';
|
||||
|
||||
class PasteboardUtil {
|
||||
|
||||
static async copyData(data: string, type: CopyDataType) {
|
||||
try {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mineType = pasteboard.MIMETYPE_TEXT_PLAIN;
|
||||
|
||||
if (type === CopyDataType.URI) {
|
||||
mineType = pasteboard.MIMETYPE_TEXT_URI;
|
||||
} else if (type === CopyDataType.HTML) {
|
||||
mineType = pasteboard.MIMETYPE_TEXT_HTML;
|
||||
}
|
||||
|
||||
const pasteData: pasteboard.PasteData = pasteboard.createData(mineType, data);
|
||||
const systemPasteboard: pasteboard.SystemPasteboard = pasteboard.getSystemPasteboard();
|
||||
|
||||
await systemPasteboard.setData(pasteData);
|
||||
} catch (err) {
|
||||
console.error('Failed to set PasteData.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export enum CopyDataType {
|
||||
TEXT,
|
||||
URI,
|
||||
HTML
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
"pages/media/PhotoPage",
|
||||
|
||||
"pages/mvvm/HomePage",
|
||||
"pages/mvvm/ArrayBindPage",
|
||||
|
||||
"pages/net/TcpSocketPage",
|
||||
"pages/net/RestAPIPage",
|
||||
|
@ -7,13 +7,13 @@
|
||||
"name": "default",
|
||||
"type": "HarmonyOS",
|
||||
"material": {
|
||||
"certpath": "build_script/sign/HM4Demo.cer",
|
||||
"storePassword": "0000001B9C6223E8C618FEFD3D871B066F744A4E9C03C09D8ED7E7C7ECE6C1F53A54A6748EC341B960E492",
|
||||
"certpath": "C:\\Users\\zyz\\.ohos\\config\\default_HMDemo_i5yHT0lu8Bugf7Se0a-mWm67_DsSdIYAWNVACnIC98c=.cer",
|
||||
"storePassword": "0000001B17961DDECEBACEACD9CAA1E45CB0BEF5D5A935C253F2AB99644951676ED1B6F102D2B5AD8BCBA2",
|
||||
"keyAlias": "debugKey",
|
||||
"keyPassword": "0000001B63515E7120BC166D17A66B98A717DE9B06276194E4317B5317F70EA2835B8AD262B9DD4FD6AB55",
|
||||
"profile": "build_script/sign/HM4Demo.p7b",
|
||||
"keyPassword": "0000001B72605A837A1D1827D656F3D157F771A9B6DEC8B264626F1EFBBDA8FF65464F416F4B5C7F9FA84F",
|
||||
"profile": "C:\\Users\\zyz\\.ohos\\config\\default_HMDemo_i5yHT0lu8Bugf7Se0a-mWm67_DsSdIYAWNVACnIC98c=.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "build_script/sign/HM4Demo.p12"
|
||||
"storeFile": "C:\\Users\\zyz\\.ohos\\config\\default_HMDemo_i5yHT0lu8Bugf7Se0a-mWm67_DsSdIYAWNVACnIC98c=.p12"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -22,7 +22,7 @@
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default",
|
||||
"compatibleSdkVersion": "4.0.0(10)",
|
||||
"compatibleSdkVersion": "5.0.0(12)",
|
||||
"runtimeOS": "HarmonyOS",
|
||||
}
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user