提交 469322d8 编写于 作者: W wanganxp

add文本分享示例

上级 8659bafa
...@@ -1022,58 +1022,58 @@ ...@@ -1022,58 +1022,58 @@
} }
}, },
{ {
"path" : "pages/API/element-takesnapshot/element-takesnapshot", "path": "pages/API/element-takesnapshot/element-takesnapshot",
"style" : "style": {
{ "navigationBarTitleText": "takeSnapshot",
"navigationBarTitleText" : "takeSnapshot", "enablePullDownRefresh": false
"enablePullDownRefresh" : false
} }
}, },
{ {
"path" : "pages/API/element-draw/element-draw", "path": "pages/API/element-draw/element-draw",
"style" : "style": {
{ "navigationBarTitleText": "getDrawableContext",
"navigationBarTitleText" : "getDrawableContext", "enablePullDownRefresh": false
"enablePullDownRefresh" : false
} }
}, },
{ {
"path" : "pages/component/general-event/transition-event", "path": "pages/component/general-event/transition-event",
"style" : "style": {
{ "navigationBarTitleText": "transitionend事件",
"navigationBarTitleText" : "transitionend事件", "enablePullDownRefresh": false
"enablePullDownRefresh" : false
} }
}, },
{ {
"path" : "pages/API/install-apk/install-apk", "path": "pages/API/install-apk/install-apk",
"style" : "style": {
{ "navigationBarTitleText": "install-apk",
"navigationBarTitleText" : "install-apk", "enablePullDownRefresh": false
"enablePullDownRefresh" : false
} }
}, },
{ {
"path" : "pages/template/schema/schema", "path": "pages/template/schema/schema",
"style" : "style": {
{ "navigationBarTitleText": "打开schema示例"
"navigationBarTitleText" : "打开schema示例"
} }
}, },
{ {
"path" : "pages/component/sticky-section/sticky-section", "path": "pages/component/sticky-section/sticky-section",
"style" : "style": {
{ "navigationBarTitleText": "sticky-section",
"navigationBarTitleText" : "sticky-section", "enablePullDownRefresh": false
"enablePullDownRefresh" : false
} }
}, },
{ {
"path" : "pages/component/list-view/list-view-multiplex", "path": "pages/component/list-view/list-view-multiplex",
"style" : "style": {
"navigationBarTitleText": "list-view-multiplex",
"enablePullDownRefresh": false
}
},
{ {
"navigationBarTitleText" : "list-view-multiplex", "path": "pages/template/share/share",
"enablePullDownRefresh" : false "style": {
"navigationBarTitleText": "分享",
"enablePullDownRefresh": false
} }
} }
......
...@@ -8,48 +8,24 @@ ...@@ -8,48 +8,24 @@
</view> </view>
<view class="uni-text-box"> <view class="uni-text-box">
<text class="hello-text">以下是部分模板示例,更多模板见插件市场:</text> <text class="hello-text">以下是部分模板示例,更多模板见插件市场:</text>
<u-link <u-link href="https://ext.dcloud.net.cn" :text="'https://ext.dcloud.net.cn'" :inWhiteList="true"></u-link>
href="https://ext.dcloud.net.cn"
:text="'https://ext.dcloud.net.cn'"
:inWhiteList="true"
></u-link>
</view> </view>
<view class="uni-panel" v-for="(item, index) in list" :key="item.id"> <view class="uni-panel" v-for="(item, index) in list" :key="item.id">
<view <view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="triggerCollapse(index, item)">
class="uni-panel-h" <text class="uni-panel-text" :class="item.enable == false ? 'text-disabled' : ''">{{ item.name }}</text>
:class="item.open ? 'uni-panel-h-on' : ''" <image :src="
@click="triggerCollapse(index, item)"
>
<text
class="uni-panel-text"
:class="item.enable == false ? 'text-disabled' : ''"
>{{ item.name }}</text
>
<image
:src="
item.pages.length > 0 item.pages.length > 0
? item.open ? item.open
? arrowUpIcon ? arrowUpIcon
: arrowDownIcon : arrowDownIcon
: arrowRightIcon : arrowRightIcon
" " class="uni-icon">
class="uni-icon"
>
</image> </image>
</view> </view>
<view class="uni-panel-c" v-if="item.open"> <view class="uni-panel-c" v-if="item.open">
<view <view class="uni-navigate-item" :hover-class="page.enable == false?'':'is--active'"
class="uni-navigate-item" v-for="(page, key) in item.pages" :key="key" @click="goDetailPage(page)">
:hover-class="page.enable == false?'':'is--active'" <text class="uni-navigate-text" :class="page.enable == false ? 'text-disabled' : ''">{{ page.name }}</text>
v-for="(page, key) in item.pages"
:key="key"
@click="goDetailPage(page)"
>
<text
class="uni-navigate-text"
:class="page.enable == false ? 'text-disabled' : ''"
>{{ page.name }}</text
>
<image :src="arrowRightIcon" class="uni-icon"></image> <image :src="arrowRightIcon" class="uni-icon"></image>
</view> </view>
</view> </view>
...@@ -61,21 +37,21 @@ ...@@ -61,21 +37,21 @@
</template> </template>
<script lang="uts"> <script lang="uts">
type Page = { type Page = {
name: string name : string
enable?: boolean enable ?: boolean
url: string url : string
} }
type ListItem = { type ListItem = {
id: string id : string
name: string name : string
open: boolean open : boolean
pages: Page[] pages : Page[]
url?: string url ?: string
enable?: boolean enable ?: boolean
} }
export default { export default {
data() { data() {
return { return {
list: [ list: [
...@@ -88,11 +64,11 @@ export default { ...@@ -88,11 +64,11 @@ export default {
pages: [ pages: [
{ {
name: '顶部搜索框随时下移长列表', name: '顶部搜索框随时下移长列表',
url:'long-list' url: 'long-list'
}, },
{ {
name: '顶部banner长列表', name: '顶部banner长列表',
url:'long-list2' url: 'long-list2'
}, },
] as Page[], ] as Page[],
}, },
...@@ -118,11 +94,11 @@ export default { ...@@ -118,11 +94,11 @@ export default {
pages: [ pages: [
{ {
name: '下划线样式', name: '下划线样式',
url:'swiper-list' url: 'swiper-list'
}, },
{ {
name: '字体放大样式', name: '字体放大样式',
url:'swiper-list2' url: 'swiper-list2'
}, },
] as Page[], ] as Page[],
}, },
...@@ -190,7 +166,19 @@ export default { ...@@ -190,7 +166,19 @@ export default {
name: '日历', name: '日历',
open: false, open: false,
pages: [] as Page[], pages: [] as Page[],
}, }, {
id: 'schema',
url: 'schema',
name: '打开外部链接',
open: false,
pages: [] as Page[],
}, {
id: 'share',
url: 'share',
name: '分享示例',
open: false,
pages: [] as Page[],
}
] as ListItem[], ] as ListItem[],
arrowUpIcon: '/static/icons/arrow-up.png', arrowUpIcon: '/static/icons/arrow-up.png',
arrowDownIcon: '/static/icons/arrow-down.png', arrowDownIcon: '/static/icons/arrow-down.png',
...@@ -198,9 +186,9 @@ export default { ...@@ -198,9 +186,9 @@ export default {
} }
}, },
methods: { methods: {
triggerCollapse(index: number, item: ListItem) { triggerCollapse(index : number, item : ListItem) {
if (item.pages.length == 0) { if (item.pages.length == 0) {
const page: Page = { const page : Page = {
name: item.name, name: item.name,
enable: item.enable, enable: item.enable,
url: item.url!, url: item.url!,
...@@ -216,7 +204,7 @@ export default { ...@@ -216,7 +204,7 @@ export default {
} }
} }
}, },
goDetailPage(e: Page) { goDetailPage(e : Page) {
if (e.enable == false) { if (e.enable == false) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
...@@ -233,9 +221,9 @@ export default { ...@@ -233,9 +221,9 @@ export default {
}) })
}, },
}, },
} }
</script> </script>
<style> <style>
@import '../../common/uni-uvue.css'; @import '../../common/uni-uvue.css';
</style> </style>
\ No newline at end of file
<template>
<view>
<button class="button" @click="shareText('https://uniapp.dcloud.io/uni-app-x','分享到')">分享</button>
</view>
</template>
<script>
import Intent from 'android.content.Intent';
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
},
}
}
</script>
<style>
.button {
margin: 30rpx;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册