diff --git a/pages.json b/pages.json
index 0db6cc829cb3d21ff76a54c0155338ba34091254..c30cb796ee0a9c654e3bc8959a4698db9b7ec4f3 100644
--- a/pages.json
+++ b/pages.json
@@ -1751,7 +1751,15 @@
"navigationBarTitleText": "",
"backgroundColorContent": "#fffae8"
}
- }
+ },
+ // #ifdef APP-ANDROID
+ {
+ "path": "pages/component/object/object",
+ "style": {
+ "navigationBarTitleText": "自定义组件"
+ }
+ }
+ // #endif
],
"globalStyle": {
"pageOrientation": "portrait",
diff --git a/pages/component/object/object.test.js b/pages/component/object/object.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..692c93173294d01045b79673cab2d92506473652
--- /dev/null
+++ b/pages/component/object/object.test.js
@@ -0,0 +1,18 @@
+describe('object.uvue', () => {
+ if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') {
+ it('object', () => {
+ expect(1).toBe(1)
+ })
+ return
+ }
+ beforeAll(async () => {
+ page = await program.reLaunch('/pages/component/object/object')
+ await page.waitFor('native-button');
+ });
+
+ it('object检测init函数是否相应', async () => {
+ await page.waitFor(600)
+ const value = await page.data('isLoad')
+ expect(value).toBe(true)
+ })
+})
diff --git a/pages/component/object/object.uvue b/pages/component/object/object.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..8e43433d2d27bbf5a033fa5b1eb8d165471ae58d
--- /dev/null
+++ b/pages/component/object/object.uvue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-native-button/changelog.md b/uni_modules/uni-native-button/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-native-button/components/native-button/native-button.vue b/uni_modules/uni-native-button/components/native-button/native-button.vue
new file mode 100644
index 0000000000000000000000000000000000000000..239a077c5db1b781cc6e67a1abc30dcec0f9656a
--- /dev/null
+++ b/uni_modules/uni-native-button/components/native-button/native-button.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-native-button/package.json b/uni_modules/uni-native-button/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..dff99bced771453d053b8024f6f4775d878f6376
--- /dev/null
+++ b/uni_modules/uni-native-button/package.json
@@ -0,0 +1,87 @@
+{
+ "id": "uni-native-button",
+ "displayName": "uni-native-button",
+ "version": "0.0.1",
+ "description": "vue开发button原生组件",
+ "keywords": [
+ "tencent",
+ "map",
+ "tmap"
+ ],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^4.25"
+ },
+ "dcloudext": {
+ "type": "uts",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "n",
+ "vue3": "y"
+ },
+ "App": {
+ "app-android": {
+ "minVersion": "21"
+ },
+ "app-ios": {
+ "minVersion": "9"
+ }
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "u",
+ "QQ": "y",
+ "钉钉": "u",
+ "快手": "u",
+ "飞书": "u",
+ "京东": "u"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-native-button/readme.md b/uni_modules/uni-native-button/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..b8b3368f4d7e5eef5a7782239c23dfc89e0f4c9a
--- /dev/null
+++ b/uni_modules/uni-native-button/readme.md
@@ -0,0 +1,3 @@
+## native-button
+
+通过 object 分装原生平台Button按钮
diff --git a/uni_modules/uni-native-button/utssdk/app-android/config.json b/uni_modules/uni-native-button/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..bf9592567f563664ee930692b3282879db6d5007
--- /dev/null
+++ b/uni_modules/uni-native-button/utssdk/app-android/config.json
@@ -0,0 +1,3 @@
+{
+ "minSdkVersion": "21"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-native-button/utssdk/app-android/index.uts b/uni_modules/uni-native-button/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..cfb237ba226b2fb42a11707e290f11660393a4c6
--- /dev/null
+++ b/uni_modules/uni-native-button/utssdk/app-android/index.uts
@@ -0,0 +1,34 @@
+import { Button } from "android.widget"
+
+export class NativeButton {
+ $element : UniObjectElement;
+
+ constructor(element : UniObjectElement) {
+ this.$element = element;
+ bindView();
+ }
+
+ button : Button | null = null;
+ bindView() {
+ //通过UniElement.getAndroidActivity()获取android平台activity 用于创建view的上下文
+ this.button = new Button($element.getAndroidActivity()!); //构建原生view
+ //限制原生Button 文案描述不自动大写
+ this.button?.setAllCaps(false)
+ //监听原生Button点击事件
+ this.button?.setOnClickListener(_ => {
+ const detail = {}
+ //构建自定义UniObjectCustomEvent返回对象
+ const event = new UniObjectCustomEvent("click", detail)
+ //响应分发原生Button的点击事件
+ $element.dispatchEvent(event)
+ })
+ //UniObjectElement 绑定 安卓原生view
+ $element.bindAndroidView(button!);
+ }
+
+ updateText(text: string) {
+ //更新原生Button 文案描述
+ this.button?.setText(text)
+ }
+
+}