日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)百度小程序教程:one-stop-interaction一站式互動(dòng)組件
  • one-stop-interaction 一站式互動(dòng)組件
    • 使用方式
      • 圖片示例
    • 評(píng)論列表支持折疊
      • 使用方式
    • Bug & Tip

    one-stop-interaction 一站式互動(dòng)組件

    基礎(chǔ)庫(kù) 3.180.3 開始支持,低版本需做兼容處理。

    十余年的烏爾禾網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。全網(wǎng)整合營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整烏爾禾建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“烏爾禾網(wǎng)站設(shè)計(jì)”,“烏爾禾網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

    解釋:一站式互動(dòng)組件,為開發(fā)者提供一整套包含評(píng)論發(fā)布器、評(píng)論列表及詳情、點(diǎn)贊、收藏、轉(zhuǎn)發(fā)功能的互動(dòng) bar 能力,互動(dòng) bar 支持自定義,此外還提供數(shù)據(jù)存儲(chǔ)、數(shù)據(jù)內(nèi)容審核、用戶接收百度 App 消息通知的一站式服務(wù)。

    使用了原 smart-sc 動(dòng)態(tài)庫(kù)引入的方式,請(qǐng)遷移到如下新的動(dòng)態(tài)庫(kù)方式接入。

    使用方式

    1.在項(xiàng)目中聲明引用 swan-interaction 動(dòng)態(tài)庫(kù)

    在 app.json 文件配置的 dynamicLib 字段中增加對(duì) swan-interaction 的引用,具體格式在使用動(dòng)態(tài)庫(kù)文檔中查看。

    • JSON
     
     
     
    1. "dynamicLib": {
    2. // 'myDynamicLib' 是個(gè)可自定義的別名。
    3. "myDynamicLib": {
    4. // provider 是要引用的動(dòng)態(tài)庫(kù)的名字,在此為 'swan-interaction'。
    5. "provider": "swan-interaction"
    6. }
    7. }

    2.創(chuàng)建一個(gè)帶評(píng)論功能的頁(yè)面,并在頁(yè)面中聲明引用 comment-list 組件
    動(dòng)態(tài)庫(kù)中的組件與其他自定義組件類似,都需要在 page 中使用。所以首先需要?jiǎng)?chuàng)建一個(gè) page,page 路徑可自定義,推薦路徑為 pages/list/index(即在小程序頁(yè)面目錄 pages 下創(chuàng)建 list 文件夾,并在文件夾下創(chuàng)建 index.js、index.swan、index.css、index.json 頁(yè)面文件)。

    頁(yè)面中引用動(dòng)態(tài)庫(kù)組件的方式是:在頁(yè)面的 json 配置的 usingSwanComponents 字段中聲明組件引用。

    • JSON
     
     
     
    1. {
    2. "navigationBarTitleText": "評(píng)論列表",
    3. "usingSwanComponents": {
    4. "comment-list": "dynamicLib://myDynamicLib/comment-list"
    5. }
    6. }

    在頁(yè)面中放入列表組件,傳入必要的參數(shù),組件詳情配置請(qǐng)參考 comment-list 評(píng)論列表組件。

    • SWAN
    • JS
    • CSS
     
     
     
    1. {{header.title}}
    2. {{header.author}}
    3. {{header.time}}
    4. {{item.data}}
    5. class="content-img"
    6. src="{{item.data.src}}"
    7. original-src="{{item.data.src}}"
    8. mode="widthFix"
    9. preview="true"
    10. lazy-load="true"/>
    11. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    12. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    13. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    14. class="img">
    15. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    16. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    17. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    18. comment-param="{{commentParam}}"
    19. detail-path="{{detailPath}}"
    20. toolbar-config="{{toolbarConfig}}"
    21. bindclickcomment="clickComment">
     
     
     
    1. Page({
    2. data: {
    3. commentParam: {},
    4. header: {
    5. title: '心疼!中國(guó)自行車女將卷入摔車事故 腹部扎入3厘米木刺堅(jiān)持完賽',
    6. avatar: 'https://b.bdstatic.com/miniapp/images/demo-dog.png',
    7. author: '百度智能小程序',
    8. time: '2020年04月14日'
    9. },
    10. content: {
    11. items: [
    12. {
    13. type: 'text',
    14. data: '測(cè)試文字'
    15. }
    16. ]
    17. },
    18. detailPath: '/pages/detail/index?params1=abd',
    19. // 底部互動(dòng) bar 的配置
    20. toolbarConfig: {
    21. // 若 moduleList 中配置有 share 模塊,默認(rèn)是有,則該屬性為必填,title 必傳
    22. share: {
    23. title: '心疼!中國(guó)自行車女將卷入摔車事故 腹部扎入3厘米木刺堅(jiān)持完賽'
    24. }
    25. }
    26. },
    27. onLoad(query) {
    28. this.setData({
    29. commentParam: {
    30. snid: '10070000311753961',
    31. path: '/pages/comment/index?snid=test_snid57',
    32. title: '測(cè)試文章標(biāo)題',
    33. content: '測(cè)試文章內(nèi)容',
    34. images: ['https://b.bdstatic.com/miniapp/images/demo-dog.png']
    35. }
    36. });
    37. },
    38. onReady() {
    39. // 用于實(shí)現(xiàn)頁(yè)面間的跳轉(zhuǎn)
    40. requireDynamicLib('myDynamicLib').listenEvent();
    41. },
    42. clickComment(e) {
    43. }
    44. });
     
     
     
    1. .article-header {
    2. padding: 0 17px;
    3. }
    4. .article-header .title {
    5. display: block;
    6. font-size: 24px;
    7. line-height: 1.5;
    8. font-weight: 700;
    9. }
    10. .article-header .source {
    11. margin-top: 24px;
    12. display: flex;
    13. align-items: flex-start;
    14. }
    15. .article-header .source image {
    16. width: 35px;
    17. height: 35px;
    18. border-radius: 100%;
    19. margin-right: 8px;
    20. background-color: #eef1f4;
    21. background-size: 16px 16px;
    22. background-repeat: no-repeat;
    23. background-position: center center;
    24. background-image: url(../common/assets/logo-default.png);
    25. }
    26. .article-header .info {
    27. display: flex;
    28. flex-direction: column;
    29. justify-content: center;
    30. height: 35px;
    31. }
    32. .article-header .info .author {
    33. font-size: 16px;
    34. line-height: 1;
    35. display: block;
    36. color: #000;
    37. margin-bottom: 7px;
    38. }
    39. .article-header .info .time {
    40. display: block;
    41. color: #999;
    42. font-size: 12px;
    43. line-height: 1;
    44. }
    45. .article-content {
    46. color: #000;
    47. font-size: 19px;
    48. line-height: 1.58;
    49. letter-spacing: 2.84;
    50. margin-bottom: 30px;
    51. }
    52. .article-content .content-img {
    53. width: 100%;
    54. margin-top: 30px;
    55. vertical-align: bottom;
    56. background-color: #eef1f4;
    57. background-size: 32px 32px;
    58. background-repeat: no-repeat;
    59. background-position: center center;
    60. background-image: url(../common/assets/logo-default.png);
    61. }
    62. .article-content .content-p {
    63. margin: 24.5px 17px -5.5px 17px;
    64. text-align: justify;
    65. word-break: break-all;
    66. }

    3.創(chuàng)建一個(gè)評(píng)論詳情頁(yè)面,并在頁(yè)面中聲明引用 comment-detail 組件
    動(dòng)態(tài)庫(kù)中的組件與其他自定義組件類似,都需要在 page 中使用。所以首先需要?jiǎng)?chuàng)建一個(gè) page,page 路徑可自定義,推薦路徑為 pages/detail/index(即在小程序頁(yè)面目錄 pages 下創(chuàng)建 detail 文件夾,并在文件夾下創(chuàng)建 index.js、index.swan、index.css、index.json 頁(yè)面文件)。

    頁(yè)面中引用動(dòng)態(tài)庫(kù)組件的方式是:在頁(yè)面的 json 配置的 usingSwanComponents 字段中聲明組件引用。

    • JSON
     
     
     
    1. {
    2. "navigationBarTitleText": "評(píng)論詳情",
    3. "usingSwanComponents": {
    4. "comment-detail": "dynamicLib://myDynamicLib/comment-detail"
    5. }
    6. }

    在頁(yè)面中放入詳情組件,傳入必要的參數(shù),組件詳情配置請(qǐng)參考 comment-detail 評(píng)論詳情組件。

    • SWAN
    • JS
     
     
     
    1. comment-param="{{commentParam}}"
    2. srid="{{srid}}"
    3. need-like-btn="{{true}}"
    4. binddelete="detailDelete">
     
     
     
    1. Page({
    2. data: {
    3. srid: '',
    4. commentParam: {}
    5. },
    6. onLoad(options) {
    7. if (options) {
    8. this.setData({
    9. srid: options.srid
    10. });
    11. }
    12. const param = getApp().globalData.commentParam;
    13. if (param && Object.keys(param).length) {
    14. this.setData({
    15. 'commentParam': param
    16. });
    17. }
    18. else {
    19. this.setData({
    20. commentParam: {
    21. snid: '10070000311753961',
    22. path: '/pages/comment/index?snid=test_snid57',
    23. title: '測(cè)試文章標(biāo)題'
    24. }
    25. });
    26. }
    27. }
    28. });

    圖片示例

    評(píng)論列表支持折疊

    對(duì)于部分開發(fā)者,在評(píng)論列表下方希望放入廣告等推薦區(qū)域,故評(píng)論列表支持折疊使用。

    使用方式

    1.創(chuàng)建一個(gè)帶評(píng)論功能的頁(yè)面,并在頁(yè)面中聲明引用 comment-list 組件
    在頁(yè)面中放入列表組件,傳入必要的可折疊參數(shù),組件詳情配置請(qǐng)參考 comment-list 評(píng)論列表組件。

    • SWAN
    • JS
    • JSON
    • CSS
     
     
     
    1. {{header.title}}
    2. {{header.author}}
    3. {{header.time}}
    4. {{item.data}}
    5. class="content-img"
    6. src="{{item.data.src}}"
    7. original-src="{{item.data.src}}"
    8. mode="widthFix"
    9. preview="true"
    10. lazy-load="true"/>
    11. comment-param="{{commentParam}}"
    12. detail-path="{{detailPath}}"
    13. is-folded="{{true}}"
    14. fold-num="{{foldNum}}"
    15. toolbar-config="{{toolbarConfig}}"
    16. view-more-path="{{viewMorePath}}"
    17. bindclickcomment="clickComment"
    18. bindviewmore="viewMore">
    19. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    20. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    21. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    22. class="img">
    23. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    24. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
    25. 歡迎使用智能小程序動(dòng)態(tài)庫(kù)
     
     
     
    1. Page({
    2. data: {
    3. commentParam: {},
    4. header: {
    5. title: '心疼!中國(guó)自行車女將卷入摔車事故 腹部扎入3厘米木刺堅(jiān)持完賽',
    6. avatar: 'https://b.bdstatic.com/miniapp/images/demo-dog.png',
    7. author: '百度智能小程序',
    8. time: '2020年04月14日'
    9. },
    10. content: {
    11. items: [
    12. {
    13. type: 'image',
    14. data: {
    15. src: 'https://b.bdstatic.com/miniapp/images/demo-dog.png'
    16. }
    17. },
    18. {
    19. type: 'text',
    20. data: '測(cè)試文字'
    21. }
    22. ]
    23. },
    24. // 評(píng)論詳情頁(yè)面路徑
    25. detailPath: '/pages/detail/index?params1=abd',
    26. // 全部評(píng)論頁(yè)面路徑
    27. viewMorePath: '/pages/all-list/index',
    28. // 折疊展示最大評(píng)論條數(shù)
    29. foldNum: 5,
    30. // 底部互動(dòng) bar 的配置
    31. toolbarConfig: {
    32. // 若 moduleList 中配置有 share 模塊,默認(rèn)是有,則該屬性為必填,title 必傳
    33. share: {
    34. title: '心疼!中國(guó)自行車女將卷入摔車事故 腹部扎入3厘米木刺堅(jiān)持完賽'
    35. }
    36. }
    37. },
    38. onLoad(query) {
    39. this.setData({
    40. commentParam: {
    41. snid: '10070000311753961',
    42. path: '/pages/comment/index?snid=test_snid57',
    43. title: '測(cè)試文章標(biāo)題',
    44. content: '測(cè)試文章內(nèi)容',
    45. images: ['https://b.bdstatic.com/miniapp/images/demo-dog.png']
    46. }
    47. });
    48. },
    49. onReady() {
    50. // 用于實(shí)現(xiàn)頁(yè)面間的跳轉(zhuǎn)
    51. requireDynamicLib('myDynamicLib').listenEvent();
    52. },
    53. clickComment(e) {
    54. },
    55. viewMore() {
    56. swan.showToast({
    57. title: 'click success'
    58. });
    59. }
    60. });
     
     
     
    1. {
    2. "navigationBarTitleText": "折疊列表頁(yè)",
    3. "usingSwanComponents": {
    4. "comment-list": "dynamicLib://myDynamicLib/comment-list"
    5. }
    6. }
     
     
     
    1. .article-header {
    2. padding: 0 39.8rpx;
    3. }
    4. .article-header .title {
    5. display: block;
    6. font-size: 56rpx;
    7. line-height: 1.5;
    8. font-weight: 700;
    9. }
    10. .article-header .source {
    11. margin-top: 56rpx;
    12. display: flex;
    13. align-items: flex-start;
    14. }
    15. .article-header .source image {
    16. width: 82rpx;
    17. height: 82rpx;
    18. border-radius: 100%;
    19. margin-right: 18.7rpx;
    20. background-color: #eef1f4;
    21. background-size: 37.4rpx 37.4rpx;
    22. background-repeat: no-repeat;
    23. background-position: center center;
    24. background-image: url(../common/assets/logo-default.png);
    25. }
    26. .article-header .info {
    27. display: flex;
    28. flex-direction: column;
    29. justify-content: center;
    30. height: 82rpx;
    31. }
    32. .article-header .info .author {
    33. font-size: 37.4rpx;
    34. line-height: 1;
    35. display: block;
    36. color: #000;
    37. margin-bottom: 16.4rpx;
    38. }
    39. .article-header .info .time {
    40. display: block;
    41. color: #999;
    42. font-size: 28rpx;
    43. line-height: 1;
    44. }
    45. .article-content {
    46. color: #000;
    47. font-size: 44.5rpx;
    48. line-height: 1.58;
    49. letter-spacing: 2.84;
    50. margin-bottom: 70.2rpx;
    51. }
    52. .article-content .content-img {
    53. width: 100%;
    54. margin-top: 70.2rpx;
    55. vertical-align: bottom;
    56. background-color: #eef1f4;
    57. background-size: 74.9rpx 74.9rpx;
    58. background-repeat: no-repeat;
    59. background-position: center center;
    60. background-image: url(../common/assets/logo-default.png);
    61. }
    62. .article-content .content-p {
    63. margin: 57.3rpx 39.8rpx -12.9rpx 39.8rpx;
    64. text-align: justify;
    65. word-break: break-all;
    66. }
    67. .list-after {
    68. padding: 30rpx 18rpx 90rpx;
    69. }
    70. .comment-list-folded-bottom-margin {
    71. height: 14.4rpx;
    72. background-color: #f5f5f5;
    73. }

    2.創(chuàng)建一個(gè)展示全部評(píng)論的頁(yè)面,并在頁(yè)面中聲明引用 comment-list 組件
    我們建議全部評(píng)論的頁(yè)面,互動(dòng) bar 僅保留評(píng)論發(fā)布。組件配置請(qǐng)參考 comment-list 評(píng)論列表組件。

    • SWAN
    • JS
    • JSON
     
     
     
    1. comment-param="{{commentParam}}"
    2. detail-path="{{detailPath}}"
    3. toolbar-config="{{toolbarConfig}}"
    4. bindclickcomment="clickComment">
     
     
     
    1. Page({
    2. data: {
    3. commentParam: {},
    4. toolbarConfig: {
    5. moduleList: []
    6. },
    7. detailPath: '/pages/detail/index?params1=abd'
    8. },
    9. onInit() {
    10. this.isOnInitCalled = true;
    11. this.init();
    12. },
    13. onLoad() {
    14. // 兼容不支持 onInit 的版本
    15. if (!this.isOnInitCalled) {
    16. this.init();
    17. }
    18. },
    19. init() {
    20. const commentParam = getApp().globalData.commentParam;
    21. if (commentParam && Object.keys(commentParam).length) {
    22. this.setData({
    23. commentParam
    24. });
    25. }
    26. else {
    27. this.setData({
    28. commentParam: {
    29. snid: '10070000311753961',
    30. path: '/pages/comment/index?snid=test_snid57',
    31. title: '測(cè)試文章標(biāo)題'
    32. }
    33. });
    34. }
    35. },
    36. onReady() {
    37. // 用于實(shí)現(xiàn)頁(yè)面間的跳轉(zhuǎn)
    38. requireDynamicLib('myDynamicLib').listenEvent();
    39. },
    40. clickComment(e) {
    41. }
    42. });
     
     
     
    1. {
    2. "navigationBarTitleText": "全部評(píng)論",
    3. "usingSwanComponents": {
    4. "comment-list": "dynamicLib://myDynamicLib/comment-list"
    5. }
    6. }

    3.創(chuàng)建一個(gè)評(píng)論詳情頁(yè)面,并在頁(yè)面中聲明引用 comment-detail 組件

    Bug & Tip

    • Tip:使用 Mars 等第三方框架開發(fā)小程序時(shí),可能存在 setData 的異步延時(shí),如在評(píng)論詳情頁(yè) srid 作為單獨(dú)參數(shù)傳入沒有生效,可作為 commentParam 中的字段傳入。
    • Tip:原有一站式互動(dòng)組件 smart-sc 因性能問題,對(duì)用戶流量產(chǎn)生影響,為避免影響線上已接入用戶,本次新的一站式互動(dòng)組件采用新的動(dòng)態(tài)庫(kù)。
    • Tip:原有一站式互動(dòng)組件的部分 bug ,如點(diǎn)贊狀態(tài)失效等,已在新一站式組件中修復(fù)。
    • Tip:新的一站式互動(dòng)組件,通用性更強(qiáng),除了頁(yè)面級(jí)別,也支持浮層的使用。
    • Tip:在 onLoad 和 onReady 生命周期內(nèi)引入requireDynamicLib('myDynamicLib').listenEvent()來實(shí)現(xiàn)頁(yè)面的跳轉(zhuǎn)。

    網(wǎng)站標(biāo)題:創(chuàng)新互聯(lián)百度小程序教程:one-stop-interaction一站式互動(dòng)組件
    文章鏈接:http://www.5511xx.com/article/cohisje.html