提交 82062827 编写于 作者: W wanganxp

微调

上级 3834c04f
...@@ -715,21 +715,21 @@ ...@@ -715,21 +715,21 @@
} }
}, },
{ {
"path": "pages/component/list-news/list", "path": "pages/template/list-news/list-news",
"style": { "style": {
"navigationBarTitleText": "列表到详情示例" "navigationBarTitleText": "列表到详情示例"
} }
}, },
{ {
"path": "pages/API/get-network-type/get-network-type", "path": "pages/template/list-news/detail/detail",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": "详情示例"
} }
}, },
{ {
"path": "pages/component/list-news/detail/detail", "path": "pages/API/get-network-type/get-network-type",
"style": { "style": {
"navigationBarTitleText": "详情示例" "navigationBarTitleText": ""
} }
}, },
{ {
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<view class="uni-list"> <view class="uni-list">
<radio-group @change="radioChange"> <radio-group @change="radioChange">
<radio class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value" <radio class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value"
:class="index < items.length - 1 ? 'uni-list-cell-line': ''" :value="item.value" :class="index < items.length - 1 ? 'uni-list-cell-line': ''" :value="item.value" :checked="index === current">
:checked="index === current">
{{item.name}} {{item.name}}
</radio> </radio>
</radio-group> </radio-group>
...@@ -13,15 +12,15 @@ ...@@ -13,15 +12,15 @@
<view class="uni-list"> <view class="uni-list">
<view class="uni-list-cell uni-list-cell-pd"> <view class="uni-list-cell uni-list-cell-pd">
<view class="uni-list-cell-db">自定义itemColor</view> <view class="uni-list-cell-db">自定义itemColor</view>
<switch :checked="itemColorCustom" @change="itemColorChange"/> <switch :checked="itemColorCustom" @change="itemColorChange" />
</view> </view>
<view class="uni-list-cell uni-list-cell-pd"> <view class="uni-list-cell uni-list-cell-pd">
<view class="uni-list-cell-db">超长列表文本</view> <view class="uni-list-cell-db">超长文本和空文本item</view>
<switch :checked="itemContentLarge" @change="itemContentLargeChange"/> <switch :checked="itemContentLarge" @change="itemContentLargeChange" />
</view> </view>
<view class="uni-list-cell uni-list-cell-pd"> <view class="uni-list-cell uni-list-cell-pd">
<view class="uni-list-cell-db">大量选项</view> <view class="uni-list-cell-db">超过6个item</view>
<switch :checked="itemNumLargeSelect" @change="itemNumLargeChange"/> <switch :checked="itemNumLargeSelect" @change="itemNumLargeChange" />
</view> </view>
</view> </view>
<view class="uni-padding-wrap"> <view class="uni-padding-wrap">
...@@ -40,9 +39,9 @@ ...@@ -40,9 +39,9 @@
data() { data() {
return { return {
title: 'action-sheet', title: 'action-sheet',
itemColorCustom:false, itemColorCustom: false,
itemContentLarge:false, itemContentLarge: false,
itemNumLargeSelect:false, itemNumLargeSelect: false,
items: [{ items: [{
value: '标题', value: '标题',
name: '有标题' name: '有标题'
...@@ -57,20 +56,8 @@ ...@@ -57,20 +56,8 @@
} }
] as ItemType[], ] as ItemType[],
current: 0, current: 0,
// #ifdef H5
buttonRect: {},
// #endif
} }
}, },
// #ifdef H5
onReady() {
this.getNodeInfo()
window.addEventListener('resize', this.getNodeInfo)
},
beforeDestroy() {
window.removeEventListener('resize', this.getNodeInfo)
},
// #endif
methods: { methods: {
radioChange(e : RadioGroupChangeEvent) { radioChange(e : RadioGroupChangeEvent) {
for (let i = 0; i < this.items.length; i++) { for (let i = 0; i < this.items.length; i++) {
...@@ -93,9 +80,9 @@ ...@@ -93,9 +80,9 @@
let itemInfo = ['item1', 'item2', 'item3', 'item4'] let itemInfo = ['item1', 'item2', 'item3', 'item4']
if(this.itemContentLarge){ if (this.itemContentLarge) {
itemInfo = ['两个黄鹂鸣翠柳,一行白鹭上青天。窗含西岭千秋雪,门泊东吴万里船', '水光潋滟晴方好,山色空蒙雨亦奇。 欲把西湖比西子,淡妆浓抹总相宜', ''] itemInfo = ['两个黄鹂鸣翠柳,一行白鹭上青天。窗含西岭千秋雪,门泊东吴万里船', '水光潋滟晴方好,山色空蒙雨亦奇。 欲把西湖比西子,淡妆浓抹总相宜', '']
}else if(this.itemNumLargeSelect){ } else if (this.itemNumLargeSelect) {
// 大量选项测试,不能超过6个元素 https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet // 大量选项测试,不能超过6个元素 https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet
itemInfo = [] itemInfo = []
for (var i = 1; i <= 10; i++) { for (var i = 1; i <= 10; i++) {
...@@ -104,18 +91,11 @@ ...@@ -104,18 +91,11 @@
} }
const that = this const that = this
if(this.itemColorCustom){ if (this.itemColorCustom) {
uni.showActionSheet({ uni.showActionSheet({
title: this.items[this.current].value, title: this.items[this.current].value,
itemList: itemInfo, itemList: itemInfo,
itemColor:"#ff00ff", itemColor: "#ff00ff",
// #ifdef H5
popover: {
// 104: navbar + topwindow 高度,暂时 fix createSelectorQuery 在 pc 上获取 top 不准确的 bug
top: that.buttonRect.top + 104 + that.buttonRect.height,
left: that.buttonRect.left + that.buttonRect.width / 2
},
// #endif
success: (e) => { success: (e) => {
console.log(e.tapIndex); console.log(e.tapIndex);
uni.showToast({ uni.showToast({
...@@ -127,17 +107,10 @@ ...@@ -127,17 +107,10 @@
console.log(e); console.log(e);
} }
}) })
}else{ } else {
uni.showActionSheet({ uni.showActionSheet({
title: this.items[this.current].value, title: this.items[this.current].value,
itemList: itemInfo, itemList: itemInfo,
// #ifdef H5
popover: {
// 104: navbar + topwindow 高度,暂时 fix createSelectorQuery 在 pc 上获取 top 不准确的 bug
top: that.buttonRect.top + 104 + that.buttonRect.height,
left: that.buttonRect.left + that.buttonRect.width / 2
},
// #endif
success: (e) => { success: (e) => {
console.log(e.tapIndex); console.log(e.tapIndex);
uni.showToast({ uni.showToast({
...@@ -154,20 +127,7 @@ ...@@ -154,20 +127,7 @@
} }
}) })
} }
}, },
// #ifdef H5
getNodeInfo() {
uni.createSelectorQuery().select('.target').boundingClientRect().exec((ret) => {
const rect = ret[0]
if (rect) {
this.buttonRect = rect
}
});
}
// #endif
} }
} }
</script> </script>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<scroll-view> <scroll-view>
<!-- #endif --> <!-- #endif -->
<view> <view>
<page-head :title="title"></page-head> <page-head title="rich-text-complex"></page-head>
<view class="uni-padding-wrap uni-common-mt"> <view class="uni-padding-wrap uni-common-mt">
<rich-text :nodes="htmlString" @itemclick="itemClick"></rich-text> <rich-text :nodes="htmlString" @itemclick="itemClick"></rich-text>
</view> </view>
...@@ -17,21 +17,21 @@ ...@@ -17,21 +17,21 @@
export default { export default {
data() { data() {
return { return {
title: 'rich-text-complex',
htmlString: '<p><a href="https://www.dcloud.io/hbuilderx.html">HBuilderX</a><br/><img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"></img><h1>HBuilderX,轻巧、极速,极客编辑器</h1><p style="color:red;"><small>HBuilderX,轻巧、极速,极客编辑器 </small><big>HBuilderX,轻巧、极速,极客编辑器</big><strong>HBuilderX,轻巧、极速,极客编辑器</strong><i>HBuilderX,轻巧、极速,极客编辑器 </i><u>HBuilderX,轻巧、极速,极客编辑器</u><del>HBuilderX,轻巧、极速,极客编辑器</del></p><h2>uni-app x,终极跨平台方案</h2>、<p style="background-color: yellow;"><small>uni-app x,终极跨平台方案 </small><big>uni-app x,终极跨平台方案</big><strong>uni-appx,终极跨平台方案 </strong><i>uni-app x,终极跨平台方案 </i><u>uni-app x,终极跨平台方案 </u><del>uni-appx,终极跨平台方案</del></p><h3>uniCloud,js serverless云服务</h3><p style="text-decoration: line-through;"><small>uniCloud,js serverless云服务 </small><big>uniCloud,jsserverless云服务</big><strong>uniCloud,js serverless云服务 </strong><i>uniCloud,js serverless云服务 </i><u>uniCloud,jsserverless云服务</u><del>uniCloud,js serverless云服务</del></p><h4>uts,大一统语言</h4><p style="text-align: center;"><small>uts,大一统语言 </small><big>uts,大一统语言 </big><strong>uts,大一统语言</strong><i>uts,大一统语言</i><u>uts,大一统语言 </u><del>uts,大一统语言</del></p><h5>uniMPSdk,让你的App具备小程序能力</h5><h6>uni-admin,开源、现成的全端管理后台</h6><ul><li style="color: red; text-align: left;">uni-app x,终极跨平台方案</li><li style="color: green; text-align: center;">uni-app x,终极跨平台方案</li><li style="color: blue; text-align: right;">uni-app x,终极跨平台方案</li></ul><a href="https://uniapp.dcloud.net.cn">uni-app</a><br/><img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"></img></p>' htmlString: '<p><a href="https://www.dcloud.io/hbuilderx.html">HBuilderX</a><br/><img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"></img><h1>HBuilderX,轻巧、极速,极客编辑器</h1><p style="color:red;"><small>HBuilderX,轻巧、极速,极客编辑器 </small><big>HBuilderX,轻巧、极速,极客编辑器</big><strong>HBuilderX,轻巧、极速,极客编辑器</strong><i>HBuilderX,轻巧、极速,极客编辑器 </i><u>HBuilderX,轻巧、极速,极客编辑器</u><del>HBuilderX,轻巧、极速,极客编辑器</del></p><h2>uni-app x,终极跨平台方案</h2>、<p style="background-color: yellow;"><small>uni-app x,终极跨平台方案 </small><big>uni-app x,终极跨平台方案</big><strong>uni-appx,终极跨平台方案 </strong><i>uni-app x,终极跨平台方案 </i><u>uni-app x,终极跨平台方案 </u><del>uni-appx,终极跨平台方案</del></p><h3>uniCloud,js serverless云服务</h3><p style="text-decoration: line-through;"><small>uniCloud,js serverless云服务 </small><big>uniCloud,jsserverless云服务</big><strong>uniCloud,js serverless云服务 </strong><i>uniCloud,js serverless云服务 </i><u>uniCloud,jsserverless云服务</u><del>uniCloud,js serverless云服务</del></p><h4>uts,大一统语言</h4><p style="text-align: center;"><small>uts,大一统语言 </small><big>uts,大一统语言 </big><strong>uts,大一统语言</strong><i>uts,大一统语言</i><u>uts,大一统语言 </u><del>uts,大一统语言</del></p><h5>uniMPSdk,让你的App具备小程序能力</h5><h6>uni-admin,开源、现成的全端管理后台</h6><ul><li style="color: red; text-align: left;">uni-app x,终极跨平台方案</li><li style="color: green; text-align: center;">uni-app x,终极跨平台方案</li><li style="color: blue; text-align: right;">uni-app x,终极跨平台方案</li></ul><a href="https://uniapp.dcloud.net.cn">uni-app</a><br/><img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"></img></p>'
} }
}, },
methods: { methods: {
itemClick(e : RichTextItemClickEvent) { itemClick(e : RichTextItemClickEvent) {
console.log(JSON.stringify(e.detail)); console.log(JSON.stringify(e.detail));
let title = ''; let clicktext = '';
if (e.detail.src != null) { if (e.detail.src != null) {
title = '点击了图片,src = ' + e.detail.src; clicktext = '点击了图片,src = ' + e.detail.src;
} else if (e.detail.href != null) { } else if (e.detail.href != null) {
title = '点击了链接,href = ' + e.detail.href; clicktext = '点击了链接,href = ' + e.detail.href;
} }
uni.showModal({ uni.showModal({
title: title content:clicktext,
showCancel:false
}); });
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!-- #ifdef APP --> <!-- #ifdef APP -->
<scroll-view> <scroll-view>
<!-- #endif --> <!-- #endif -->
<page-head :title="title"></page-head> <page-head title="rich-text-tags"></page-head>
<view class="uni-padding-wrap uni-common-mt"> <view class="uni-padding-wrap uni-common-mt">
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">支持的HTML标签</text> <text class="uni-title-text">支持的HTML标签</text>
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
export default { export default {
data() { data() {
return { return {
title: 'rich-text-tags',
data: [ data: [
{ {
name: '<br/>', name: '<br/>',
...@@ -301,14 +300,15 @@ ...@@ -301,14 +300,15 @@
methods: { methods: {
itemClick(e : RichTextItemClickEvent) { itemClick(e : RichTextItemClickEvent) {
console.log(JSON.stringify(e.detail)); console.log(JSON.stringify(e.detail));
let title = ''; let clicktext = '';
if (e.detail.src != null) { if (e.detail.src != null) {
title = '点击了图片,src = ' + e.detail.src; clicktext = '点击了图片,src = ' + e.detail.src;
} else if (e.detail.href != null) { } else if (e.detail.href != null) {
title = '点击了链接,href = ' + e.detail.href; clicktext = '点击了链接,href = ' + e.detail.href;
} }
uni.showModal({ uni.showModal({
title: title content:clicktext,
showCancel:false
}); });
} }
} }
......
...@@ -130,10 +130,9 @@ ...@@ -130,10 +130,9 @@
{ {
id: 'network', id: 'network',
name: '网络', name: '网络',
open: false,
pages: [ pages: [
{ {
name: '发起一个请求', name: '发起请求request',
url: 'request', url: 'request',
}, },
{ {
...@@ -158,10 +157,6 @@ ...@@ -158,10 +157,6 @@
url: 'websocket-global', url: 'websocket-global',
api: ["connectSocket", "onSocketOpen", "onSocketError", "sendSocketMessage", "onSocketMessage", "closeSocket", "onSocketClose"] api: ["connectSocket", "onSocketOpen", "onSocketError", "sendSocketMessage", "onSocketMessage", "closeSocket", "onSocketClose"]
}, },
{
name: '请求云函数',
url: 'call-function',
},
] as Page[], ] as Page[],
}, },
{ {
...@@ -348,7 +343,6 @@ ...@@ -348,7 +343,6 @@
{ {
id: 'location', id: 'location',
name: '位置', name: '位置',
open: false,
pages: [ pages: [
{ {
name: '获取当前位置', name: '获取当前位置',
...@@ -375,7 +369,6 @@ ...@@ -375,7 +369,6 @@
{ {
id: 'storage', id: 'storage',
name: '数据存储', name: '数据存储',
open: false,
pages: [ pages: [
{ {
name: 'storage(key-value存储)', name: 'storage(key-value存储)',
...@@ -384,6 +377,16 @@ ...@@ -384,6 +377,16 @@
}, },
] as Page[], ] as Page[],
}, },
{
id: 'unicloud',
name: 'uniCloud',
pages: [
{
name: '云函数',
url: 'call-function',
},
] as Page[],
},
/* { /* {
id: "rewarded-video-ad", id: "rewarded-video-ad",
url: "rewarded-video-ad", url: "rewarded-video-ad",
......
...@@ -87,14 +87,6 @@ export default { ...@@ -87,14 +87,6 @@ export default {
enable: false enable: false
}, },
*/ */
{
name: 'list(新闻)',
url: '/pages/component/list-news/list',
},
// {
// name: 'list',
// url: '/pages/component/long-list/long-list',
// },
{ {
name: 'list-view', name: 'list-view',
}, },
......
...@@ -88,6 +88,13 @@ export default { ...@@ -88,6 +88,13 @@ export default {
enable: true, enable: true,
pages: [] as Page[], pages: [] as Page[],
}, },
{
id: 'list-news',
url: 'list-news',
name: '列表到详情',
open: false,
pages: [] as Page[],
},
{ {
id: 'scroll-fold-nav', id: 'scroll-fold-nav',
url: 'scroll-fold-nav', url: 'scroll-fold-nav',
...@@ -100,16 +107,16 @@ export default { ...@@ -100,16 +107,16 @@ export default {
url: 'swiper-list', url: 'swiper-list',
name: 'swiper-list', name: 'swiper-list',
open: false, open: false,
enable: true, pages: [
pages: [] as Page[], {
name: '下划线样式',
url:'swiper-list'
}, },
{ {
id: 'swiper-list2', name: '字体放大样式',
url: 'swiper-list2', url:'swiper-list2'
name: 'swiper-list2', },
open: false, ] as Page[],
enable: true,
pages: [] as Page[],
}, },
{ {
id: 'custom-refresher', id: 'custom-refresher',
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
const cover = detail.cover; const cover = detail.cover;
const title = detail.title; const title = detail.title;
uni.navigateTo({ uni.navigateTo({
url: '/pages/component/list-news/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title url: '/pages/template/list-news/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title
}); });
}, },
bannerClick(e:Banner){ bannerClick(e:Banner){
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
const cover = detail.cover; const cover = detail.cover;
const title = detail.title; const title = detail.title;
uni.navigateTo({ uni.navigateTo({
url: '/pages/component/list-news/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title url: '/pages/template/list-news/detail/detail?post_id=' + post_id + "&cover=" + cover + "&title=" + title
}); });
}, },
setTime(items: UTSJSONObject[]): Item[] { setTime(items: UTSJSONObject[]): Item[] {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册