提交 5147afd5 编写于 作者: 打打卡夫卡's avatar 打打卡夫卡

增加 xtoast 集成示例

上级 e32f1f42
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</template> </template>
<script> <script>
import { getLogoPath,playAssetAudio } from '../../uni_modules/uts-advance' import { getLogoPath,playAssetAudio } from '../../uni_modules/uts-toast'
export default { export default {
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
}, },
onLoad:function(){ onLoad:function(){
this.logo = getLogoPath() this.logo = getLogoPath()
console.log("getLogoPath");
}, },
methods: { methods: {
testLogoLoad(){ testLogoLoad(){
......
{ {
// 使用NDK时支持的CPU类型,可选
"abis": [ "abis": [
"arm64-v8a" "arm64-v8a"
], ],
// 依赖的仓储配置,可选,打包时会合并到原生工程的build.gradle中
"dependencies": [ "dependencies": [
"com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.4.9"
], ],
// Android系统版本要求,最低Android 5.0
"minSdkVersion": 21 "minSdkVersion": 21
} }
{
"id": "uts-toast",
"displayName": "uts-toast",
"version": "1.0.0",
"description": "uts-toast",
"keywords": [
"uts-toast"
],
"repository": "",
"engines": {
"HBuilderX": "^3.6.0"
},
"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": "u",
"aliyun": "u"
},
"client": {
"Vue": {
"vue2": "n",
"vue3": "y"
},
"App": {
"app-android": "u",
"app-ios": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file
# uts-toast
### 开发文档
[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
[UTS 原生插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
[Hello UTS](https://gitcode.net/dcloud/hello-uts/-/tree/dev)
\ 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_modules.uts_toast">
<!--创建前台服务权限-->
<application>
</application>
</manifest>
{
"abis": [
"arm64-v8a"
],
"minSdkVersion": 21
}
import {
getUniActivity
} from "io.dcloud.uts.android";
import XToast from "com.hjq.xtoast.XToast";
import R from "io.dcloud.uni_modules.uts_toast.R";
export function getLogoPath():string{
// new XToast<Any>(getUniActivity())
// .setDuration(1000)
// .setContentView(R.layout.window_hint)
// .setImageDrawable(android.R.id.icon, android.R.mipmap.sym_def_app_icon)
// .setText(android.R.id.message, "一秒后自动消失")
// .show();
XToast<XToast<Any>>(getUniActivity())
.setDuration(1000)
.setContentView(R.layout.window_hint)
.setImageDrawable(android.R.id.icon, android.R.mipmap.sym_def_app_icon)
.setText(android.R.id.message, "一秒后自动消失")
.show()
return "hello toast"
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#000000"
android:gravity="center"
android:layout_margin="100dp"
android:minWidth="120dp"
android:minHeight="120dp"
android:orientation="vertical">
<ImageView
android:id="@android:id/icon"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_marginTop="14dp"
/>
<TextView
android:id="@android:id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="8dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="14dp"
android:maxLines="3"
android:textColor="#ffffff"
android:textSize="14sp"
tools:text="提示语" />
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册