提交 95edcade 编写于 作者: DCloud-yyl's avatar DCloud-yyl

Merge branch 'dev' into alpha

# Conflicts:
#	pages/API/get-file-system-manager/get-file-system-manager.test.js
#	pages/API/get-file-system-manager/get-file-system-manager.uvue
......@@ -19,8 +19,8 @@ export function createApp() {
str: 'default reactive string',
num: 0,
bool: false,
})
app.config.globalProperties.globalPropertiesFn = () : string => {
} as UTSJSONObject)
app.config.globalProperties.globalPropertiesFn = function () : string {
console.log('this.globalPropertiesStr', this.globalPropertiesStr)
console.log('this.globalPropertiesNum', this.globalPropertiesNum)
return `globalPropertiesStr: ${this.globalPropertiesStr}, globalPropertiesNum: ${this.globalPropertiesNum}`
......@@ -29,4 +29,4 @@ export function createApp() {
return {
app
}
}
}
......@@ -163,7 +163,7 @@
"style": {
"navigationBarTitleText": "video-format"
}
},
},
{
"path": "pages/component/web-view/web-view",
"style": {
......@@ -344,13 +344,14 @@
"navigationBarTitleText": "数据存储"
}
},
// #ifndef WEB
{
"path": "pages/API/get-file-system-manager/get-file-system-manager",
"style": {
"navigationBarTitleText": "沙盒文件管理"
"navigationBarTitleText": "文件管理"
}
},
// #endif
{
"path": "pages/API/action-sheet/action-sheet",
"style": {
......@@ -393,23 +394,23 @@
"navigationBarTitleText": "获取定位"
}
},
{
"path": "pages/API/interceptor/interceptor",
"style": {
"navigationBarTitleText": "拦截器"
}
},
{
"path": "pages/API/interceptor/page1",
"style": {
"navigationBarTitleText": "拦截器测试页面 1"
}
},
{
"path": "pages/API/interceptor/page2",
"style": {
"navigationBarTitleText": "拦截器测试页面 2"
}
{
"path": "pages/API/interceptor/interceptor",
"style": {
"navigationBarTitleText": "拦截器"
}
},
{
"path": "pages/API/interceptor/page1",
"style": {
"navigationBarTitleText": "拦截器测试页面 1"
}
},
{
"path": "pages/API/interceptor/page2",
"style": {
"navigationBarTitleText": "拦截器测试页面 2"
}
},
{
"path": "pages/API/request/request",
......@@ -543,6 +544,7 @@
"navigationBarTitleText": "get-window-info"
}
},
// #ifndef WEB
{
"path": "pages/API/facial-recognition-verify/facial-recognition-verify",
"style": {
......@@ -550,6 +552,7 @@
"enablePullDownRefresh": false
}
},
// #endif
{
"path": "pages/API/element-takesnapshot/element-takesnapshot",
"style": {
......@@ -1071,46 +1074,50 @@
}
},
{
"path": "pages/component/sticky-header/sticky-header",
"path": "pages/component/sticky-header/sticky-header",
"style": {
"navigationBarTitleText": "sticky-header",
"navigationBarTitleText": "sticky-header",
"enablePullDownRefresh": false
}
},
{
"path": "pages/component/general-event/transition-event",
"style": {
"navigationBarTitleText": "transitionend事件",
"path": "pages/component/general-event/transition-event",
"style": {
"navigationBarTitleText": "transitionend事件",
"enablePullDownRefresh" : false
}
},
// #ifndef WEB
{
"path": "pages/template/schema/schema",
"style": {
"navigationBarTitleText": "打开schema示例"
"path": "pages/template/schema/schema",
"style": {
"navigationBarTitleText": "打开schema示例"
}
},
// #endif
{
"path": "pages/component/sticky-section/sticky-section",
"style": {
"navigationBarTitleText": "sticky-section",
"path": "pages/component/sticky-section/sticky-section",
"style": {
"navigationBarTitleText": "sticky-section",
"enablePullDownRefresh" : false
}
},
{
"path": "pages/component/list-view/list-view-multiplex",
"style": {
"navigationBarTitleText": "list-view-multiplex",
"path": "pages/component/list-view/list-view-multiplex",
"style": {
"navigationBarTitleText": "list-view-multiplex",
"enablePullDownRefresh" : false
}
},
// #ifndef WEB
{
"path": "pages/template/share/share",
"style": {
"navigationBarTitleText": "分享",
"enablePullDownRefresh": false
"path": "pages/template/share/share",
"style": {
"navigationBarTitleText": "分享",
"enablePullDownRefresh": false
}
},
// #endif
{
"path" : "pages/component/general-event/touch-event",
"style" :
......
......@@ -8,7 +8,7 @@ describe('ExtApi-DownloadFile', () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600);
await page.callMethod('jest_downloadFile');
await page.waitFor(500);
await page.waitFor(1000);
res = await page.data('jest_result');
});
......
......@@ -43,21 +43,21 @@ describe('ExtApi-FileManagerTest', () => {
})
// 先清除文件,需要清除全部可能存在的历史测试文件,避免运行失败
const btnUnLinkFileButton = await page.$('.btn-clear-file')
const btnUnLinkFileButton = await page.$('#btn-clear-file')
await btnUnLinkFileButton.tap()
await isDone()
// 清除文件夹
const btnRmDirButton = await page.$('.btn-remove-dir')
const btnRmDirButton = await page.$('#btn-remove-dir')
await btnRmDirButton.tap()
await isDone()
// 重新创建测试目录
const btnMkdDirButton = await page.$('.btn-mkdir')
const btnMkdDirButton = await page.$('#btn-mkdir')
await btnMkdDirButton.tap()
await isDone()
const btnReadDirButton = await page.$('.btn-read-dir')
const btnReadDirButton = await page.$('#btn-read-dir')
await btnReadDirButton.tap()
await isDone()
......@@ -104,7 +104,7 @@ describe('ExtApi-FileManagerTest', () => {
expect(JSON.stringify(fileListSuccess)).toEqual("[\"b\"]")
// 测试写入文件
const btnWriteFileButton = await page.$('.btn-write-file')
const btnWriteFileButton = await page.$('#btn-write-file')
await btnWriteFileButton.tap()
await isDone()
// 检查目录列表数量
......@@ -115,7 +115,7 @@ describe('ExtApi-FileManagerTest', () => {
fileListSuccess = await getData('fileListSuccess')
expect(JSON.stringify(fileListSuccess)).toEqual("[\"b\",\"1.txt\"]")
// 获取和对比 文件内容
const btnReadFileButton = await page.$('.btn-read-file')
const btnReadFileButton = await page.$('#btn-read-file')
await btnReadFileButton.tap()
await isDone()
let readFileRet = await getData('readFileRet')
......@@ -134,7 +134,7 @@ describe('ExtApi-FileManagerTest', () => {
readFileRet = await getData('readFileRet')
expect(readFileRet).toEqual("If you were a teardrop;In my eye,For fear of losing you,I would never cry.And if the golden sun,Should cease to shine its light,Just one smile from you,Would make my whole world bright.")
const btnGetFileInfoButton = await page.$('.btn-get-file-info')
const btnGetFileInfoButton = await page.$('#btn-get-file-info')
await btnGetFileInfoButton.tap()
await isDone()
......@@ -161,7 +161,7 @@ describe('ExtApi-FileManagerTest', () => {
copyFromFile:"a/1.txt",
copyToFile:"a/2.txt"
})
const btnCopyFileButton = await page.$('.btn-copy-file')
const btnCopyFileButton = await page.$('#btn-copy-file')
await btnCopyFileButton.tap()
await isDone()
......@@ -181,7 +181,7 @@ describe('ExtApi-FileManagerTest', () => {
renameToFile:"a/3.txt"
})
const btnRenameFileButton = await page.$('.btn-rename-file')
const btnRenameFileButton = await page.$('#btn-rename-file')
await btnRenameFileButton.tap()
await isDone()
......@@ -211,22 +211,22 @@ describe('ExtApi-FileManagerTest', () => {
// 先清除文件,需要清除全部可能存在的历史测试文件,避免运行失败
const btnUnLinkFileButton = await page.$('.btn-unlink-file')
const btnUnLinkFileButton = await page.$('#btn-unlink-file')
await btnUnLinkFileButton.tap()
await isDone()
// 清除文件夹
const btnRmDirButton = await page.$('.btn-remove-dir')
const btnRmDirButton = await page.$('#btn-remove-dir')
await btnRmDirButton.tap()
await isDone()
// 重新创建测试目录
const btnMkdDirButton = await page.$('.btn-mkdir')
const btnMkdDirButton = await page.$('#btn-mkdir')
await btnMkdDirButton.tap()
await isDone()
const btnReadDirButton = await page.$('.btn-read-dir')
const btnReadDirButton = await page.$('#btn-read-dir')
await btnReadDirButton.tap()
await isDone()
......@@ -283,7 +283,7 @@ describe('ExtApi-FileManagerTest', () => {
// 获取和对比 文件内容
const btnReadFileButton = await page.$('.btn-read-file')
const btnReadFileButton = await page.$('#btn-read-file')
await btnReadFileButton.tap()
await isDone()
let readFileRet = await getData('readFileRet')
......@@ -299,7 +299,7 @@ describe('ExtApi-FileManagerTest', () => {
})
const btnWriteFileButton = await page.$('.btn-write-file')
const btnWriteFileButton = await page.$('#btn-write-file')
await btnWriteFileButton.tap()
await isDone()
......@@ -325,7 +325,7 @@ describe('ExtApi-FileManagerTest', () => {
getFileInfoAlgorithm:"md5",
})
const btnGetFileInfoButton = await page.$('.btn-get-file-info')
const btnGetFileInfoButton = await page.$('#btn-get-file-info')
await btnGetFileInfoButton.tap()
await isDone()
......@@ -367,7 +367,7 @@ describe('ExtApi-FileManagerTest', () => {
renameToFile:"a/没有提前创建的目录/3.txt"
})
const btnRenameFileButton = await page.$('.btn-rename-file')
const btnRenameFileButton = await page.$('#btn-rename-file')
await btnRenameFileButton.tap()
await isDone()
......@@ -404,7 +404,7 @@ describe('ExtApi-FileManagerTest', () => {
copyToFile:"a/提前创建的目录/4.txt"
})
const btnCopyFileButton = await page.$('.btn-copy-file')
const btnCopyFileButton = await page.$('#btn-copy-file')
await btnCopyFileButton.tap()
await isDone()
......@@ -457,22 +457,22 @@ describe('ExtApi-FileManagerTest', () => {
// 先清除文件,需要清除全部可能存在的历史测试文件,避免运行失败
const btnClearFileButton = await page.$('.btn-clear-file')
const btnClearFileButton = await page.$('#btn-clear-file')
await btnClearFileButton.tap()
await isDone()
// 清除文件夹
const btnRmDirButton = await page.$('.btn-remove-dir')
const btnRmDirButton = await page.$('#btn-remove-dir')
await btnRmDirButton.tap()
await isDone()
// 重新创建测试目录,期望通过 recursive = true的 文件夹删除,得到一个空的 /a 目录
const btnMkdDirButton = await page.$('.btn-mkdir')
const btnMkdDirButton = await page.$('#btn-mkdir')
await btnMkdDirButton.tap()
await isDone()
const btnReadDirButton = await page.$('.btn-read-dir')
const btnReadDirButton = await page.$('#btn-read-dir')
await btnReadDirButton.tap()
await isDone()
......@@ -483,7 +483,7 @@ describe('ExtApi-FileManagerTest', () => {
// 检查资源文件,此时不存在
const btnAccessFileButton = await page.$('.btn-access-file')
const btnAccessFileButton = await page.$('#btn-access-file')
await btnAccessFileButton.tap()
await isDone()
......@@ -505,7 +505,7 @@ describe('ExtApi-FileManagerTest', () => {
expect(accessFileRet).toEqual('access:ok')
// 尝试删除资源,期望失败
const btnUnLinkFileButton = await page.$('.btn-unlink-file')
const btnUnLinkFileButton = await page.$('#btn-unlink-file')
await btnUnLinkFileButton.tap()
await isDone()
......@@ -520,7 +520,7 @@ describe('ExtApi-FileManagerTest', () => {
copyFromFile:"static/list-mock/safe.png",
copyToFile:"a/从代码目录拷贝的资源.png"
})
const btnCopyFileButton = await page.$('.btn-copy-file')
const btnCopyFileButton = await page.$('#btn-copy-file')
await btnCopyFileButton.tap()
await isDone()
......@@ -548,7 +548,7 @@ describe('ExtApi-FileManagerTest', () => {
expect(accessFileRet).toEqual('')
// 从页面的按钮触发一次文件复制
const btnCopyStaticFileButton = await page.$('.btn-copyStatic-file')
const btnCopyStaticFileButton = await page.$('#btn-copyStatic-file')
await btnCopyStaticFileButton.tap()
await isDone()
......@@ -598,21 +598,21 @@ describe('ExtApi-FileManagerTest', () => {
})
// 先清除文件,需要清除全部可能存在的历史测试文件,避免运行失败
const btnUnLinkFileButton = await page.$('.btn-unlink-file')
const btnUnLinkFileButton = await page.$('#btn-unlink-file')
await btnUnLinkFileButton.tap()
await isDone()
// 清除文件夹
const btnRmDirButton = await page.$('.btn-remove-dir')
const btnRmDirButton = await page.$('#btn-remove-dir')
await btnRmDirButton.tap()
await isDone()
// 重新创建测试目录,期望通过 recursive = true的 文件夹删除,得到一个空的 /a 目录
const btnMkdDirButton = await page.$('.btn-mkdir')
const btnMkdDirButton = await page.$('#btn-mkdir')
await btnMkdDirButton.tap()
await isDone()
const btnReadDirButton = await page.$('.btn-read-dir')
const btnReadDirButton = await page.$('#btn-read-dir')
await btnReadDirButton.tap()
await isDone()
......@@ -622,17 +622,17 @@ describe('ExtApi-FileManagerTest', () => {
expect(JSON.stringify(fileListSuccess)).toEqual('[]')
// 先用utf-8 写入内容
const btnWriteFileButton = await page.$('.btn-write-file')
const btnWriteFileButton = await page.$('#btn-write-file')
await btnWriteFileButton.tap()
await isDone()
const btnReadFileButton = await page.$('.btn-read-file')
const btnReadFileButton = await page.$('#btn-read-file')
await btnReadFileButton.tap()
await isDone()
let readFileRet = await getData('readFileRet')
expect(readFileRet).toEqual("我爱北京天安门,天安门前太阳升")
const btnGetFileInfoButton = await page.$('.btn-get-file-info')
const btnGetFileInfoButton = await page.$('#btn-get-file-info')
await btnGetFileInfoButton.tap()
await isDone()
......@@ -729,7 +729,7 @@ describe('ExtApi-FileManagerTest', () => {
})
// 先清除文件,需要清除全部可能存在的历史测试文件,避免运行失败
const btnUnLinkFileButton = await page.$('.btn-unlink-file')
const btnUnLinkFileButton = await page.$('#btn-unlink-file')
await btnUnLinkFileButton.tap()
await isDone()
......@@ -746,15 +746,15 @@ describe('ExtApi-FileManagerTest', () => {
await isDone()
// // 清除文件夹
const btnRmDirButton = await page.$('.btn-remove-dir')
const btnRmDirButton = await page.$('#btn-remove-dir')
await btnRmDirButton.tap()
await isDone()
// // 重新创建测试目录
const btnMkdDirButton = await page.$('.btn-mkdir')
const btnMkdDirButton = await page.$('#btn-mkdir')
await btnMkdDirButton.tap()
await isDone()
const btnReadDirButton = await page.$('.btn-read-dir')
const btnReadDirButton = await page.$('#btn-read-dir')
await btnReadDirButton.tap()
await isDone()
......@@ -777,11 +777,11 @@ describe('ExtApi-FileManagerTest', () => {
let lastFailError = await getData('lastFailError')
console.log(lastFailError)
const btnWriteFileButton = await page.$('.btn-write-file')
const btnWriteFileButton = await page.$('#btn-write-file')
await btnWriteFileButton.tap()
await isDone()
const btnStatFileButton = await page.$('.btn-stat-file')
const btnStatFileButton = await page.$('#btn-stat-file')
await btnStatFileButton.tap()
await isDone()
......@@ -819,7 +819,7 @@ describe('ExtApi-FileManagerTest', () => {
copyFromFile:'file:///android_asset/uni-uts/uni-prompt/toast_error.png',
copyToFile:'a/m/3.txt',
})
const btnCopyFileButton = await page.$('.btn-copy-file')
const btnCopyFileButton = await page.$('#btn-copy-file')
await btnCopyFileButton.tap()
await isDone()
......
......@@ -4,20 +4,20 @@
<!-- #endif -->
<text>显示简易操作日志,详细日志需真机运行查看</text><button size="mini" @click="log=''">清空日志</button>
<text style="margin: 2px; padding: 2px; border: 1px solid #000000;" :value="log" />
<button type="primary" @tap="statFileInfoTest" class="btn-stat-file">递归获取目录files的Stats对象{{statFile}}</button>
<button type="primary" @tap="mkdirTest" class="btn-mkdir">创建文件夹{{mkdirFile}}</button>
<button type="primary" @tap="writeFileTest" class="btn-write-file">覆盖写入文件{{writeFile}}</button>
<button type="primary" @tap="readDirTest" class="btn-read-dir">读取文件夹{{readDir}}</button>
<button type="primary" @tap="readFileTest" class="btn-read-file">读取文件{{readFile}}</button>
<button type="primary" @tap="copyFileTest" class="btn-copy-file">复制文件{{copyFromFile}}到{{copyToFile}}</button>
<button type="primary" @tap="statFileInfoTest" id="btn-stat-file">递归获取目录files的Stats对象{{statFile}}</button>
<button type="primary" @tap="mkdirTest" id="btn-mkdir">创建文件夹{{mkdirFile}}</button>
<button type="primary" @tap="writeFileTest" id="btn-write-file">覆盖写入文件{{writeFile}}</button>
<button type="primary" @tap="readDirTest" id="btn-read-dir">读取文件夹{{readDir}}</button>
<button type="primary" @tap="readFileTest" id="btn-read-file">读取文件{{readFile}}</button>
<button type="primary" @tap="copyFileTest" id="btn-copy-file">复制文件{{copyFromFile}}到{{copyToFile}}</button>
<button type="primary" @tap="renameFileTest"
class="btn-rename-file">重命名文件{{renameFromFile}}到{{renameToFile}}</button>
<button type="primary" @tap="accessFileTest" class="btn-access-file">判断文件{{accessFile}}是否存在</button>
<button type="primary" @tap="getFileInfoTest" class="btn-get-file-info">获取文件信息{{getFileInfoFile}}</button>
<button type="primary" @tap="unlinkTest" class="btn-unlink-file">删除文件{{unlinkFile}}</button>
<button type="primary" @tap="copyStaticToFilesTest" class="btn-copyStatic-file">从static目录复制文件到a目录</button>
<button type="primary" @tap="unlinkAllFileTest" class="btn-clear-file">删除文件夹{{rmDirFile}}下的所有文件</button>
<button type="primary" @tap="rmdirTest" class="btn-remove-dir">删除文件夹{{rmDirFile}}</button>
id="btn-rename-file">重命名文件{{renameFromFile}}到{{renameToFile}}</button>
<button type="primary" @tap="accessFileTest" id="btn-access-file">判断文件{{accessFile}}是否存在</button>
<button type="primary" @tap="getFileInfoTest" id="btn-get-file-info">获取文件信息{{getFileInfoFile}}</button>
<button type="primary" @tap="unlinkTest" id="btn-unlink-file">删除文件{{unlinkFile}}</button>
<button type="primary" @tap="copyStaticToFilesTest" id="btn-copyStatic-file">从static目录复制文件到a目录</button>
<button type="primary" @tap="unlinkAllFileTest" id="btn-clear-file">删除文件夹{{rmDirFile}}下的所有文件</button>
<button type="primary" @tap="rmdirTest" id="btn-remove-dir">删除文件夹{{rmDirFile}}</button>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
......@@ -76,7 +76,7 @@
methods: {
statFileInfoTest: function (e : any) {
statFileInfoTest: function (_ : any) {
let fileManager = uni.getFileSystemManager()
fileManager.stat({
......@@ -107,7 +107,7 @@
} as StatOptions)
},
getFileInfoTest: function (e : any) {
getFileInfoTest: function () {
let fileManager = uni.getFileSystemManager()
fileManager.getFileInfo({
......@@ -139,7 +139,7 @@
},
copyFileTest: function (e : any) {
copyFileTest: function () {
let fileManager = uni.getFileSystemManager()
......@@ -169,7 +169,7 @@
} as CopyFileOptions)
},
renameFileTest: function (e : any) {
renameFileTest: function () {
let fileManager = uni.getFileSystemManager()
......@@ -199,7 +199,7 @@
} as RenameOptions)
},
readDirTest: function (e : any) {
readDirTest: function () {
let fileManager = uni.getFileSystemManager()
fileManager.readdir({
dirPath: `${this.basePath}${this.readDir}`,
......@@ -231,7 +231,7 @@
},
writeFileTest: function (e : any) {
writeFileTest: function (_ : any) {
let fileManager = uni.getFileSystemManager()
fileManager.writeFile({
......@@ -263,7 +263,7 @@
},
readFileTest: function (e : any) {
readFileTest: function () {
let fileManager = uni.getFileSystemManager()
......@@ -294,7 +294,7 @@
} as ReadFileOptions)
},
rmdirTest: function (e : any) {
rmdirTest: function () {
let fileManager = uni.getFileSystemManager()
fileManager.rmdir({
dirPath: `${this.basePath}${this.rmDirFile}`,
......@@ -322,7 +322,7 @@
} as RmDirOptions)
},
mkdirTest: function (e : any) {
mkdirTest: function () {
// 准备测试数据
let fileManager = uni.getFileSystemManager()
......@@ -353,7 +353,7 @@
} as MkDirOptions)
},
accessFileTest: function (e : any) {
accessFileTest: function () {
this.accessFileRet = ''
let fileManager = uni.getFileSystemManager()
fileManager.access({
......@@ -382,7 +382,7 @@
} as AccessOptions)
},
unlinkTest: function (e : any) {
unlinkTest: function () {
let fileManager = uni.getFileSystemManager()
......@@ -410,7 +410,7 @@
}
} as UnLinkOptions)
},
unlinkAllFileTest: function (e : any) {
unlinkAllFileTest: function () {
let fileManager = uni.getFileSystemManager()
fileManager.readdir({
dirPath: `${this.basePath}${this.rmDirFile}`,
......@@ -460,7 +460,7 @@
}
} as ReadDirOptions)
},
copyStaticToFilesTest: function (e : any) {
copyStaticToFilesTest: function () {
let fileManager = uni.getFileSystemManager()
......
......@@ -22,7 +22,7 @@ async function request(page, method, header, data, url) {
header: header
})
res = await page.callMethod('jest_request')
await page.waitFor(200);
await page.waitFor(500);
res = await page.data('jest_result');
expect(res).toBe(true)
}
......
......@@ -40,10 +40,10 @@
<view class="uni-padding-wrap">
<view class="uni-btn-v">
<button class="uni-btn btn-getStorageInfoASync" type="primary" @tap="getStorageInfo">
获取存储概述-异步
获取存储概述信息-异步
</button>
<button class="uni-btn btn-getStorageInfoSync" @tap="getStorageInfoSync">
获取存储概述-同步
获取存储概述信息-同步
</button>
</view>
<text>{{ storageInfo }}</text>
......
......@@ -8,7 +8,7 @@ describe('ExtApi-UploadFile', () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600);
await page.callMethod('jest_uploadFile');
await page.waitFor(500);
await page.waitFor(1000);
res = await page.data('jest_result');
});
......
......@@ -8,7 +8,7 @@ describe('ExtApi-WebSocket', () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600);
await page.callMethod('jest_connectSocket');
await page.waitFor(500);
await page.waitFor(1500);
res = await page.data('jest_result');
});
......
describe('component-native-list-view', () => {
describe('component-native-overflow', () => {
let page
beforeAll(async () => {
//打开list-view测试页
......
......@@ -21,10 +21,18 @@
<text class="text">点击修改Background</text>
<view class="base-style transition-background" id="styleBackground" @click="changeBackground"></view>
</view>
<view class="container">
<text class="text">动态修改Background</text>
<view class="base-style" id="propertyStyleBackground" @click="propertyChangeBackground"></view>
</view>
<view class="container">
<text class="text">点击修改Transform</text>
<view class="base-style transition-transform" id="styleTransform" @click="changeTransform"></view>
</view>
<view class="container">
<text class="text">点击修改Transform(含transform-origin)</text>
<view class="base-style transition-transform" style="transform-origin: 0 0;" id="styleTransformWithOrigin" @click="changeTransformWithOrigin"></view>
</view>
<view class="container">
<text class="text">点击修改Border</text>
<view class="base-style transition-border" id="styleBorder" @click="changeBorder"></view>
......@@ -57,6 +65,11 @@
styleBorder: null as Element | null,
isTransitionstylePosition: false,
stylePosition: null as Element | null,
isSetTransition: false,
isTransitionpropertystyleBackground: false,
propertyStyleBackground: null as Element | null,
isTransitionStyleTransformWithOrigin: false,
styleTransformWithOrigin: null as Element | null,
}
},
onReady() {
......@@ -67,6 +80,8 @@
this.styleTransform = uni.getElementById("styleTransform")
this.styleBorder = uni.getElementById("styleBorder")
this.stylePosition = uni.getElementById("stylePosition")
this.propertyStyleBackground = uni.getElementById("propertyStyleBackground")
this.styleTransformWithOrigin = uni.getElementById("styleTransformWithOrigin")
},
methods: {
changeWidthOrHeight() {
......@@ -107,6 +122,18 @@
)
this.isTransitionstyleBackground = !this.isTransitionstyleBackground
},
propertyChangeBackground() {
if (!this.isSetTransition) {
this.propertyStyleBackground?.style?.setProperty("transition-property", "background-color")
this.propertyStyleBackground?.style?.setProperty("transition-duration", "1000")
this.isSetTransition = true
}
this.propertyStyleBackground?.style?.setProperty("background-color", this.isTransitionpropertystyleBackground
? 'brown'
: 'black'
)
this.isTransitionpropertystyleBackground = !this.isTransitionpropertystyleBackground
},
changeTransform() {
this.styleTransform?.style?.setProperty("transform", this.isTransitionStyleTransform
? 'rotate(0deg)'
......@@ -114,6 +141,13 @@
)
this.isTransitionStyleTransform = !this.isTransitionStyleTransform
},
changeTransformWithOrigin() {
this.styleTransformWithOrigin?.style?.setProperty("transform", this.isTransitionStyleTransformWithOrigin
? 'scaleX(1)'
: 'scaleX(0)'
)
this.isTransitionStyleTransformWithOrigin = !this.isTransitionStyleTransformWithOrigin
},
changeBorder() {
this.styleBorder?.style?.setProperty("border-color", this.isTransitionstyleBorder
? 'brown'
......@@ -186,4 +220,4 @@
transition-property: left;
transition-duration: 1000;
}
</style>
\ No newline at end of file
</style>
......@@ -139,6 +139,14 @@ describe('component-native-input', () => {
// await page.waitFor(500)
// })
it("cursor-color", async () => {
await page.setData({
cursor_color: "transparent",
})
await page.waitFor(500)
expect(await (await page.$('.uni-input-cursor-color')).property("cursor-color")).toBe("transparent")
})
it("afterAllTestScreenshot", async () => {
const image = await program.screenshot({
fullPage: true
......
......@@ -77,8 +77,8 @@
<view class="uni-input-wrapper">
<input class="uni-input" :cursor-spacing="1000" placeholder="光标与键盘的距离为1000px" />
</view>
</view>
</view>
<view>
<view class="uni-title">
<text class="uni-title-text">自动获取焦点</text>
......@@ -134,6 +134,15 @@
<view class="uni-input-wrapper">
<input ref="input2" class="uni-input" value="0123456789" :selection-start="selectionStart" :selection-end="selectionEnd" />
</view>
</view>
<view>
<view class="uni-title" @click="changeCursorColor">
<text class="uni-title-text">设置光标颜色为透明(点击本行文字生效,再点复位)</text>
</view>
<view class="uni-input-wrapper">
<input class="uni-input uni-input-cursor-color" :cursor-color="cursor_color" value="光标颜色" />
</view>
</view>
<view>
......@@ -218,7 +227,8 @@
showClearIcon: false,
inputClearValue: '',
showPassword: true,
cursor: -1,
cursor: -1,
cursor_color: "#3393E2",
selectionStart: -1,
selectionEnd: -1,
inputEventDetail: '',
......@@ -290,6 +300,13 @@
},
test_check_input_value():number {
return this.onMaxLengthInputValue.length
},
changeCursorColor(){
if(this.cursor_color == "#3393E2"){
this.cursor_color = "transparent"
}else{
this.cursor_color = "#3393E2"
}
}
}
}
......
......@@ -61,6 +61,13 @@ describe('component-native-textarea', () => {
} = await textarea.size()
expect(height).toBeLessThanOrEqual(150)
}) */
it("cursor-color", async () => {
await page.setData({
cursor_color: "transparent",
})
await page.waitFor(500)
expect(await textarea.property("cursor-color")).toBe("transparent")
})
it("inputmode", async () => {
const inputmodeEnum = await page.data("inputmode_enum")
......@@ -73,16 +80,4 @@ describe('component-native-textarea', () => {
await page.waitFor(500)
}
})
it("confirm-type", async () => {
const inputmodeEnum = await page.data("confirm_type_enum")
for (var i = 0; i < inputmodeEnum.length; i++) {
var x = inputmodeEnum[i]
console.log(x['value'], x['name'])
await page.callMethod("radio_change_confirm_type_enum", x['value']);
await page.waitFor(500)
expect(await textarea.property("confirm-type")).toEqual(x['name'])
await page.waitFor(500)
}
})
});
......@@ -12,9 +12,8 @@ export default {
auto_focus_boolean: false,
default_value:"",
maxlength:-1,
confirm_type_enum: [{"value":0,"name":"send"},{"value":1,"name":"search"},{"value":2,"name":"next"},{"value":3,"name":"go"},{"value":4,"name":"done"}] as ItemType[],
confirm_type_enum_current: 0,
inputmode_enum: [{"value":0,"name":"none"},{"value":1,"name":"text"},{"value":2,"name":"decimal"},{"value":3,"name":"numeric"},{"value":4,"name":"tel"},{"value":5,"name":"search"},{"value":6,"name":"email"},{"value":7,"name":"url"}] as ItemType[],
inputmode_enum: [{"value":0,"name":"none"},{"value":1,"name":"text"},{"value":2,"name":"decimal"},{"value":3,"name":"numeric"},{"value":4,"name":"tel"},{"value":5,"name":"search"},{"value":6,"name":"email"},{"value":7,"name":"url"}] as ItemType[],
cursor_color: "#3393E2",
inputmode_enum_current: 0
}
},
......@@ -39,8 +38,8 @@ export default {
change_auto_height_boolean(checked : boolean) { this.auto_height_boolean = checked },
change_confirm_hold_boolean(checked : boolean) { this.confirm_hold_boolean = checked },
change_focus_boolean(checked : boolean) { this.focus_boolean = checked },
change_auto_focus_boolean(checked : boolean) { this.auto_focus_boolean = checked },
radio_change_confirm_type_enum(checked : number) { this.confirm_type_enum_current = checked },
change_auto_focus_boolean(checked : boolean) { this.auto_focus_boolean = checked },
change_cursor_color_boolean(checked : boolean) { if(checked){ this.cursor_color = "transparent"} else {this.cursor_color = "#3393E2"}},
radio_change_inputmode_enum(checked : number) { this.inputmode_enum_current = checked }
}
}
......@@ -53,12 +52,12 @@ export default {
class="uni-textarea"
:auto-focus="auto_focus_boolean"
:focus="focus_boolean"
:confirm-type="confirm_type_enum[confirm_type_enum_current].name"
:confirm-hold="confirm_hold_boolean"
:auto-height="auto_height_boolean"
:fixed="fixed_boolean"
:show-confirm-bar="show_confirm_bar_boolean"
:adjust-position="adjust_position_boolean"
:adjust-position="adjust_position_boolean"
:cursor-color="cursor_color"
:inputmode="inputmode_enum[inputmode_enum_current].name"
:maxlength="maxlength"
@click="textarea_click"
......@@ -118,12 +117,12 @@ export default {
:defaultValue="false"
title="自动获取焦点"
@change="change_auto_focus_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="改变光标颜色为透明"
@change="change_cursor_color_boolean"
></boolean-data>
<enum-data
:items="confirm_type_enum"
title="设置键盘右下角按钮的文字"
@change="radio_change_confirm_type_enum"
></enum-data>
<enum-data
:items="inputmode_enum"
title="是一个枚举属性,它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。在符合条件的高版本webview里,uni-app的 web 和 app-vue 平台中可使用本属性。"
......@@ -141,7 +140,7 @@ export default {
padding: 10rpx 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
flex-direction: row;
justify-content: center;
justify-content: center;
}
.main .list-item {
......
......@@ -404,7 +404,7 @@
name: '文件',
pages: [
{
name: 'fileSystemManager沙盒文件管理',
name: 'fileSystemManager文件管理',
url: 'get-file-system-manager'
},
] as Page[],
......
<template>
<view>
<button class="button" @click="shareText('https://uniapp.dcloud.io/uni-app-x','分享到')">分享</button>
</view>
<view id="viewshot">
<button class="button" @click="shareText('https://uniapp.dcloud.io/uni-app-x','分享到')">分享文本</button>
<button class="button" @click="shareSnapShot">指定view截图并分享</button>
</view>
</template>
<script>
import Intent from 'android.content.Intent';
import Intent from 'android.content.Intent';
import File from 'java.io.File';
export default {
data() {
return {
export default {
data() {
return {
}
},
methods: {
shareText(text:string,title:string){
const context = UTSAndroid.getUniActivity()!;
const intent = new Intent(Intent.ACTION_SEND)
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
context.startActivity(Intent.createChooser(intent, title));
// 这里是简单的文本分享示例,如需分享文件图片,需要使用fileProvider
},
}
}
}
},
methods: {
shareText(text : string, title : string) {
const context = UTSAndroid.getUniActivity()!;
const intent = new Intent(Intent.ACTION_SEND)
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
context.startActivity(Intent.createChooser(intent, title));
// 这里是简单的文本分享示例,如需分享文件图片,需要使用fileProvider
},
shareSnapShot() {
uni.getElementById("viewshot")?.takeSnapshot(
{
success: function (res) {
// 打印截图文件临时路径
console.log(res.tempFilePath)
const context = UTSAndroid.getUniActivity()!;
const intent = new Intent(Intent.ACTION_SEND)
intent.setType("image/*");
let file = new File(res.tempFilePath)
const uri = UTSAndroid.getFileProviderUri(file) //3.99支持
intent.putExtra(Intent.EXTRA_STREAM, uri);
context.startActivity(Intent.createChooser(intent, "分享到"));
},
fail: function (res) {
console.log(res)
uni.showToast({
icon: 'error',
title: '截图失败'
})
}
}
)
},
}
}
</script>
<style>
.button {
margin: 30rpx;
}
.button {
margin: 30rpx;
}
</style>
## 1.0.3(2023-10-27)
遵循UniError规范
## 1.0.2(2023-10-27)
修改文档
## 1.0.1(2023-10-27)
支持js层调用
## 1.0.0(2023-10-26)
安装apk的插件
{
"id": "uni-installApk",
"displayName": "uni-installApk",
"version": "1.0.3",
"description": "uni-installApk",
"keywords": [
"uni-installApk"
],
"repository": "",
"engines": {
"HBuilderX": "^3.94"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "android.permission.REQUEST_INSTALL_PACKAGES"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"uni-ext-api": {
"uni": {
"installApk": {
"name": "installApk",
"app": {
"js": true,
"kotlin": true,
"swift": false
}
}
}
},
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-android": "y",
"app-ios": "n"
},
"H5-mobile": {
"Safari": "n",
"Android Browser": "n",
"微信浏览器(Android)": "n",
"QQ浏览器(Android)": "n"
},
"H5-pc": {
"Chrome": "n",
"IE": "n",
"Edge": "n",
"Firefox": "n",
"Safari": "n"
},
"小程序": {
"微信": "n",
"阿里": "n",
"百度": "n",
"字节跳动": "n",
"QQ": "n",
"钉钉": "n",
"快手": "n",
"飞书": "n",
"京东": "n"
},
"快应用": {
"华为": "n",
"联盟": "n"
}
}
}
}
}
\ No newline at end of file
# uni-installApk
## 使用说明
Android平台安装Apk
**注意: 3.95以下需要自定义基座**
### uni.installApk(options : InstallApkOptions):void
安装apk
参数说明
```
type InstallApkOptions = {
/**
* apk文件地址
*/
filePath : string,
/**
* 接口调用成功的回调函数
* @defaultValue null
*/
success ?: (res : any) => void,
/**
* 接口调用失败的回调函数
* @defaultValue null
*/
fail ?: (err : any) => void,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
* @defaultValue null
*/
complete ?: (res : any) => void,
}
```
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="io.dcloud.uni.installApk">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
</manifest>
\ No newline at end of file
import { InstallApkOptions, InstallApkSuccess } from "../interface.uts"
import { InstallApkFailImpl } from "../unierror.uts"
import Intent from 'android.content.Intent';
import Build from 'android.os.Build';
import File from 'java.io.File';
import FileProvider from 'androidx.core.content.FileProvider';
import Context from 'android.content.Context';
import Uri from 'android.net.Uri';
export function installApk(options : InstallApkOptions) : void {
const context = UTSAndroid.getAppContext() as Context
const filePath = UTSAndroid.convert2AbsFullPath(options.filePath)
const apkFile = new File(filePath)
if (!apkFile.exists() && !apkFile.isFile()) {
let error = new InstallApkFailImpl(1300002);
options.fail?.(error)
options.complete?.(error)
return
}
const intent = new Intent()
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.setAction(Intent.ACTION_VIEW)
if (Build.VERSION.SDK_INT >= 24) {
const authority = context.getPackageName() + ".dc.fileprovider"
const apkUri = FileProvider.getUriForFile(context, authority, apkFile)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
}
context.startActivity(intent)
const success : InstallApkSuccess = {
errMsg: "success"
}
options.success?.(success)
options.complete?.(success)
}
\ No newline at end of file
declare namespace UniNamespace {
interface InstallApkSuccess {
/**
* 安装成功消息
*/
errMsg : string
}
type InstallApkErrorCode = 1300002
interface InstallApkFail {
errCode : InstallApkErrorCode
}
type InstallApkComplete = any
type InstallApkSuccessCallback = (res : InstallApkSuccess) => void
type InstallApkFailCallback = (err : InstallApkFail) => void
type InstallApkCompleteCallback = (res : InstallApkComplete) => void
interface InstallApkOptions {
/**
* apk文件地址
*/
filePath : string,
/**
* 接口调用成功的回调函数
* @defaultValue null
*/
success ?: InstallApkSuccessCallback | null,
/**
* 接口调用失败的回调函数
* @defaultValue null
*/
fail ?: InstallApkFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
* @defaultValue null
*/
complete ?: InstallApkCompleteCallback | null
}
}
declare interface Uni {
/**
* installApk()
* @description
* 安装apk
* @param {InstallApkOptions}
* @return {void}
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "3.94+",
* "unixVer": "3.94+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @example
```typescript
uni.installApk({
filePath: "/xx/xx/xx.apk",
complete: (res: any) => {
console.log("complete => " + JSON.stringify(res));
}
});
```
*/
installApk(options : UniNamespace.InstallApkOptions) : void
}
export interface Uni {
/**
* installApk()
* @description
* 安装apk
* @param {InstallApkOptions}
* @return {void}
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "3.94+",
* "unixVer": "3.94+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @example
```typescript
uni.installApk({
filePath: "/xx/xx/xx.apk",
complete: (res: any) => {
console.log("complete => " + JSON.stringify(res));
}
});
```
*/
installApk(options : InstallApkOptions) : void
}
export type InstallApkSuccess = {
/**
* 安装成功消息
*/
errMsg : string
}
export type InstallApkComplete = any
export type InstallApkSuccessCallback = (res : InstallApkSuccess) => void
/**
* 错误码
* - 1300002 找不到文件
*/
export type InstallApkErrorCode = 1300002
/**
* 网络请求失败的错误回调参数
*/
export interface InstallApkFail extends IUniError {
errCode : InstallApkErrorCode
};
export type InstallApkFailCallback = (err : InstallApkFail) => void
export type InstallApkCompleteCallback = (res : InstallApkComplete) => void
export type InstallApkOptions = {
/**
* apk文件地址
*/
filePath : string,
/**
* 接口调用成功的回调函数
* @defaultValue null
*/
success ?: InstallApkSuccessCallback | null,
/**
* 接口调用失败的回调函数
* @defaultValue null
*/
fail ?: InstallApkFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
* @defaultValue null
*/
complete ?: InstallApkCompleteCallback | null
}
\ No newline at end of file
import { InstallApkErrorCode, InstallApkFail } from "./interface.uts"
/**
* 错误主题
*/
export const UniErrorSubject = 'uni-installApk';
/**
* 错误码
* @UniError
*/
export const UniErrors : Map<InstallApkErrorCode, string> = new Map([
/**
* 找不到文件
*/
[1300002, 'No such file'],
]);
export class InstallApkFailImpl extends UniError implements InstallApkFail {
override errCode : InstallApkErrorCode
constructor(errCode : InstallApkErrorCode) {
super();
this.errSubject = UniErrorSubject;
this.errCode = errCode;
this.errMsg = UniErrors[errCode] ?? "";
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册