更新记录

2.0.0(2024-12-13) 下载此版本

[V2.0.0.20241213-alpha] 开始支持 DCloud 插件市场的 Uni-Modules 模块化版本


平台兼容性

uni-app

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
√ - √ √ √ - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
√ - - - - - - - - - - -

其他

多语言 暗黑模式 宽屏模式 蒸汽模式
× × √ ×

Muz Doraemon 哆啦 A 梦

哆啦 A 梦。基于 Uni-App 的 VUE3 组件库——Жидзин(Zidjin)矢争系列组件库。

注意:文档编撰格式参考 Element UI 组件文档。

安装

推荐使用 npm 的方式安装。

npm install muz-doraemon

引入

全局引入,在 pages.json 中写入以下内容:

{
    "pages": [],
    "globalStyle": {
        "navigationStyle": "custom" // 启用自定义导航条
    },
    "easycom": {
        "autoscan": true, // 自动查找安装、引用、注册符合“components/组件名称/组件名称.vue”目录结构的组件。
        "custom": {
            "^muz-(.*)": "muz-doraemon/src/muz-$1/muz-$1.vue" // 自定义组件正则匹配规则,如果需要匹配node_modules内的vue文件,需要使用packageName/path/to/vue-file-$1.vue形式的匹配规则
        }
    }
}

局部引入,在 vue 页面文件中写入以下内容

import {MuzItem, MuzListArea, ...} from 'muz-doraemon';
export default {
    components: {
        MuzItem,
        MuzListArea,
        ...
    },
};

主组件

Doraemon 哆啦 A 梦

哆啦 A 梦的组件百宝箱。

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-doraemon :list="list"></muz-doraemon>
</template>

<script>
import {MuzDoraemon} from 'muz-doraemon';
export default {
    data: ()=>({
        list: [
            ...
        ],
    })
};
</script>

UML 流程图

Doraemon Attributes

参数 说明 类型 可选值 默认值
root-url 根域名。小程序/APP 需要添加域名 string — —
share-info 分享信息 object {} —
page-param 传入页面参数,用于定制化不同页面过滤结果 object {page,id,nav,page} —
list 组件化的列表配置 array<object> — —
editable 启用编辑
适用:tl-form
boolean true false

Option of List

参数 说明 类型 可选值 默认值
show 是否显示 boolean false true
component 组件名称。
符合渲染配置化的组件。
string muz-divider,
muz-background,
muz-tab-bar,
muz-classify,
muz-item,
muz-list-area,
muz-item-area
muz-order-bar
tl-form
—
classes 自定义类名 string — —
styles 自定义样式。
作用于组件根标签。
object 例:{fontSize: "14px",}, —
config 组件配置。
详见本文组件。
object — —
list
适用:muz-classify
分类列表 array<object> 详见 muz-classify 组件
item
适用:muz-item
条数据模版 object 详见 muz-item 组件
itemTemplate
适用:muz-list-area,
muz-item-area
条数据模版。
详见:Item 条数据
object 详见 muz-item 组件 —
itemTemplateSet
适用:muz-list-area
条数据模版集合。 object<name, object> 详见 muz-item 组件 —
request
适用:muz-list-area,
muz-item-area
组件数据请求配置 object 详见:muz-list-area Option of Request (请求选项) —
optionsRequest
适用:muz-list-area,
muz-item-area
多组选项的请求配置 array<object> 详见:muz-list-area Option of Request (请求选项)

Doraemon Method

名称 说明
refresh 刷新页面(含子组件)
next 下一页
watchOnce 即使监听到 pageParam 参数无变化,也监听一次强制刷新

Doraemon Slot

名称 说明

新版已弃用,原因:不支持小程序
自定义插槽。
详见:条数据 .slot

基础组件

Background 背景

背景组件。

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-background :config="config" />
</template>

<script>
import { ZjTable } from 'zj-element';
export default {
    data: () => ({
        config: {
            backgroundImage: '/images/bg.png',
        },
    }),
};
</script>

Background Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
config 组件配置 object — —

Option of Config

参数 说明 类型 可选值 默认值
backgroundImage 背景图片 string — —

Top-Bar 顶部栏

顶部栏

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-plus-bar title="标题" :is-search="true" />
</template>

<script>
import { ZjTable } from 'zj-element';
export default {
    data: () => ({}),
};
</script>

Nav-Bar Attributes

参数 说明 类型 可选值 默认值
title 标题 sring — 标题
rtext 右侧文件 sring — —
root 是否根页,无返回 boolean true false
is-search 是否显示搜索 boolean true false
is-add 是否显示添加 boolean true false
is-edit 是否显示编辑 boolean true false
is-delete 是否显示删除 boolean true false
is-scan 是否显示扫码 boolean true false
is-fIlter 是否显示过滤 boolean true false
is-more 是否显示更多 boolean true false
is-with 是否显示分享??? boolean true false
is-left-search 是否显示右侧搜索 boolean true false
is-plus 是否显示加号 boolean true false
is-customize 是否左侧自定义 boolean true false
customize-title 自定义内容 文字 sring — —
is-off 是否显示左侧关闭 boolean true false
is-dropdown 是否显示下拉 boolean true false
dropdownDelete 下拉的删除 boolean true false
dropdownEdit 下拉的编辑 boolean true false
dropdownWith 下拉的分享??? boolean true false

Event

事件名称 说明 回调参数
search-info 点击搜索触发 搜索的内容
open-drop-search 打开/关闭下拉搜索栏时触发 打开状态,布尔值

Classify 分类图标

分类图标组件。

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-classify :config="it.config" :list="list" @classify="onClassify" />
</template>

<script>
export default {
    data: () => ({
        config: {
            backgroundImage: '/images/bg.png',
        },
    }),
};
</script>

Classify Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
title 分类大标题 string — —
subtitle 副标题 string — —
config 组件配置 object — —
list 分类列表 array<object> 例:[{
icon: '/icon/news.svg',
text: '投标报价',
value: '',
}],
—
row 每行显示个数 number — 5

Option of Config

参数 说明 类型 可选值 默认值
noBorder 是否无边 boolean true false
isCircle 是否圆形图标 boolean true false
isLeftAlign 是否左对齐 boolean true false
thumb 图标大小 string medium / small / mini medium
nodeText 指定文本节点键名 string — text
itemStyles 自定义分类外框样式 object — —
iconStyles 自定义分类图标样式 object — —

Option of List

参数 说明 类型 可选值 默认值
icon 图标地址
如果不传则默认显示文本第一个字符
string — —
text 文本,分类名称 string — —
subtitle 副标题,分类副标题 string — —
to
或 url(歧义,将弃用)
跳转链接 string — —
emit 自定义信号 string, object<emit, ...> — —

Event

事件名称 说明 回调参数
clicks 点击触发,代替 click —
classify 点击分类图标时触发 ( item: 目前的点击对象 )
emit 点击分类图标时触发 ( emit: 信号名称, item: 目前的点击对象, config: 信号包配置 )

Divider 分隔行

分隔行组件。

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-divider :config="it.config" />
</template>

<script>
import { ZjTable } from 'zj-element';
export default {
    data: () => ({
        config: {
            backgroundImage: '/images/bg.png',
        },
    }),
};
</script>

Divider Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
config 组件配置 object — —

Option of Config

参数 说明 类型 可选值 默认值
title 分隔行标题 string — —
to
或 url(歧义,将弃用)
点击标题的跳转地址
需启用 clickable
string — —
backgroundImage 背景图片 string — —
clickable 启动跳转 boolean false true
mode 跳转模式 string navigate, redirect, relaunch navigate

Menu 菜单列表

菜单列表

基本用法

<template>
    <muz-menu :list="list" thumb-size="medium"></muz-menu>
</template>

<script>
export default {
    data: () => ({
        list: [
            {
                text: '我的发布',
                rightText: '全部',
                icon: '',
                to: '/pages/timeline/timeline',
                config: {
                    noBorder: true,
                    isLeftAlign: true,
                    thumb: 'min',
                },
                children: [
                    {
                        text: '报名中',
                        icon: '/static/icons/icon-bid-clock.svg',
                        to: '',
                    },
                ],
            },
            {
                group: '隐私',
                children: [
                    {
                        text: '俄友圈权限',
                    },
                ],
            },
        ],
    }),
};
</script>

Muz-Menu Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
list 分类列表 array<object> — —
thumbSize 自定义图标大小 object — —
list-type 列表类型 string card, menu menu
  • list-type 为 card 时,实际调用的是 muz-classify 做为内置组件

Option of List

参数 说明 类型 可选值 默认值
groupName 分组名称 string — —
icon 菜单图标 string — —
text 菜单文本 string — —
subtitle 副标题 string — —
sidenote 右侧旁注 string — —
rightIcon 右侧图标 string — —
to 跳转路径 string — —
thumbSize 图标尺寸 string large, medium, small, mini, min medium
noBorder 是否有边框 boolean true false
config 配置项
仅适用:
详见:Classify 分类图标 “config”
object — —
children 子菜单列表
同 Option of List
array<object> — —
emit 自定义信号 object — —

Option of List's Config

参数 说明 类型 可选值 默认值
noBorder 是否有边框 boolean true false
isLeftAlign 是否左对齐 boolean true false
thumb 图标尺寸 string medium / small / mini —

Casket 匣子盒

匣子盒

基本用法

<template>
    <muz-casket :raw-item="item" :open-check="true" :checked="isChecked(item.id)" @checked="onChecked"></muz-casket>
</template>

<script>
export default {
    data: () => ({
        item: {
            id: 23, title: '中华'
        },
        casketSelected:{}
    }),
    computed: {
        isChecked() {
            return id => !!this.casketSelected[id];
        },
    }
};
</script>

Muz-Casket Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
checked 选中状态 boolean true false
open-check 开启选框 boolean true false
node-key 指定主键节点名称 string — id
raw-item 数据源
指定匣子需要包裹的数据
object — —
disabled-check 待开发 — — —
disabled-swipe-action 待开发 — — —
auto-close 待开发 — — —
options 待开发 — — —
duration 待开发 — — —

动态请求组件

动态组件自带数据请求功能

Tab-Bar 标签栏

标签栏

基础用法

<template>
    <muz-tab-bar v-if="it.component === 'muz-tab-bar'" :default="it.default" :page-param="currentParam" :config="it.config" :request="it.request" @tab="onTab" />
</template>

<script>
export default {
    data: () => ({}),
};
</script>

Tab-Bar Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
default 选中高亮显示 [String, Number] — —
pageParam 界面传参数 Object
config 当前激活的导航按钮 Object — —
request 请求导航条配置 Object

Option of Config

参数 说明 类型 可选值 默认值
nodeLabel 节点标签键名 string — show
nodeValue 节点值键名 string — value
nodeShow 节点显示键名 string — show
unshiftList 头部插入标签列表 Array[Object] [{value: "全部",}]
注意:value 与 valueNode 的值保持一致
—
appendList 尾部插入标签列表 Array[Object] [{value: "其他",}]
注意:value 与 valueNode 的值保持一致
—

Nav-Bar 导航栏

导航栏

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-nav-bar current-nav="home" :nav-list="list"></muz-nav-bar>
</template>

<script>
import {ZjTable} from 'zj-element';
export default {
    data: ()=>({
        list: [
            {
                key: 'home',
                icon: '/static/icons/icon-home.svg',
                activeIcon: '/static/icons/icon-home-color.svg',
                title: '首页',
                url: '/pages/home/home',
            },
            {
                key: 'me',
                icon: '/static/icons/icon-me.svg',
                activeIcon: '/static/icons/icon-me-color.svg',
                title: '我',
                url: '/apps/hbsp-me/me/me',
            },
        ],
    })
};
</script>

Nav-Bar Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
current-nav 当前激活的导航按钮 string — —
current 当前激活的下标按钮 number — -1
nav-list 导航条配置 array<object> {
key: 'me',
icon: '/static/icon-me.svg',
activeIcon: '/static/icon-me-color.svg',
title: '我',
url: '/apps/hbsp-me/me/me',
},
—
request 请求导航条配置
close-url-active 关闭自动检查激活
即根据 Url 地址匹配激活
boolean true false
is-tab-mode 启用标签,暂时弃用 boolean true false

Order-Bar 订单栏

订单栏

基础用法

[^图像示例]: 注:图像示例统一 800×300 像素,特殊除外。

<template>
    <muz-order-bar current-nav="home" :nav-list="list"></muz-nav-bar>
</template>

<script>
import {MuzOrderBar} from 'muz-doraemon';
export default {
    data: ()=>({})
};
</script>

Order Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
item 订单条数据配置 object 详见 muz-item 组件 —
config 配置 object — —
all-checked 是否全选 boolean true false
checked-list 已选择列表数据 array<object> — —
page-param 页面参数
用于接受页面传参
object — —

Option of Config

参数 说明 类型 可选值 默认值
height 订单栏高度 number — 100
nodePrice 价格节点键
用于前端统计总价
string — 'price'
nodeKey 主键节点键
用于生成已选 ID 列表,默认 id
string — 'id'
fixed 小数点位数 number — 2
showCheck 是否显示全选框 boolean true false
openCheckStorage 开启全选写入缓存
缓存 key 名默认为 checked-list
boolean true false
split 指定返回已选 ID 列表的分割符 string — ','

网页端专用组件

Header 页头

页面头部

基本用法

<template>
    <muz-header :logo="logo" :navs="list" current="home"></muz-header>
</template>

<script>
export default {
    data: () => ({
        logo: '',
        list: [
            {
                key: 'home',
                title: '首页',
                url: '/',
            },
            {
                key: 'news',
                title: '新闻',
                url: '/news',
                children: [
                    {
                        title: '栏目类别',
                        icon: 'icons/ico_air.png',
                        url: '',
                        rank: 'https://oss.muztak.cn/icons/icon-plain-double-right-small-black.svg',
                        rows: 2,
                        children: [
                            {
                                title: '图片新闻',
                                url: '',
                                icon: 'https://oss.muztak.cn/icons/icon-plain-image-color.svg',
                            },
                            {
                                title: '文字新闻',
                                url: '',
                                icon: 'https://oss.muztak.cn/icons/icon-plain-book-color.svg',
                            },
                            {
                                title: '热点话题',
                                url: '',
                                icon: 'https://oss.muztak.cn/resources/bid-online/icons/bbx-news-poundSign.svg',
                            },
                            {
                                title: '网站动态',
                                url: '',
                                icon: 'https://oss.muztak.cn/resources/bid-online/icons/bbx-news-companyDynamic.svg',
                            },
                        ],
                    },
                    {
                        title: '活动',
                        rows: 1,
                        children: [
                            {
                                title: '成交喜报',
                                cover: 'http://i.muztak.cn/images/yellow-river.jpg',
                                url: '',
                            },
                            {
                                title: '新人有礼',
                                cover: 'http://i.muztak.cn/images/landscape-sakura.jpg',
                                url: '',
                            },
                        ],
                    },
                ],
            },
        ],
    }),
};
</script>

Muz-Header Attributes

参数 说明 类型 可选值 默认值
logo 网站图标文件地址 string — —
logoUrl 网站图标跳转地址 string — —
current 当前高亮导航 string — —
navs 导航条列表,详见:Header-Nav 页头导航条 array<object> — —
auto-position 自动计算导航条位置
如果导航条不在页面顶端,需设置true,这可能导致个别情况下显示BUG,待修复
boolean true false

Header-Nav 页头导航条

页面头部导航条。Header-Nav组件是Header组件的子组件,也可独立使用

基本用法

<template>
    <muz-header-nav :navs="list" current="home"></muz-header-nav>
</template>

<script>
export default {
    data: () => ({
        list: [
            {
                key: 'home',
                title: '首页',
                url: '/',
            },
            {
                key: 'news',
                title: '新闻',
                url: '/news',
                children: [
                    {
                        title: '栏目类别',
                        icon: 'icons/ico_air.png',
                        url: '',
                        rank: 'https://oss.muztak.cn/icons/icon-plain-double-right-small-black.svg',
                        rows: 2,
                        children: [
                            {
                                title: '图片新闻',
                                url: '',
                                icon: 'https://oss.muztak.cn/icons/icon-plain-image-color.svg',
                            },
                            {
                                title: '文字新闻',
                                url: '',
                                icon: 'https://oss.muztak.cn/icons/icon-plain-book-color.svg',
                            },
                            {
                                title: '热点话题',
                                url: '',
                                icon: 'https://oss.muztak.cn/resources/bid-online/icons/bbx-news-poundSign.svg',
                            },
                            {
                                title: '网站动态',
                                url: '',
                                icon: 'https://oss.muztak.cn/resources/bid-online/icons/bbx-news-companyDynamic.svg',
                            },
                        ],
                    },
                    {
                        title: '活动',
                        rows: 1,
                        children: [
                            {
                                title: '成交喜报',
                                cover: 'http://i.muztak.cn/images/yellow-river.jpg',
                                url: '',
                            },
                            {
                                title: '新人有礼',
                                cover: 'http://i.muztak.cn/images/landscape-sakura.jpg',
                                url: '',
                            },
                        ],
                    },
                ],
            },
        ],
    }),
};
</script>

Muz-Header-Nav Attributes

参数 说明 类型 可选值 默认值
config 配置,移动版样式,暂未开发完成
current 当前高亮导航 string — —
navs 导航条列表 array<object> — —
has-placeholder 有否导航占位 false true
auto-position 自动计算导航条位置
如果导航条不在页面顶端,需设置true,这可能导致个别情况下显示BUG,待修复
boolean true false

Option of Navs

参数 说明 类型 可选值 默认值
key 唯一关键字。用于激活高亮 string — —
title 一级导航菜单名 string — —
url 跳转地址。可自动识别外链 string — —
children 二级导航菜单组。如有多个组则平铺显示 array<object> — —

Option of Children's Config

参数 说明 类型 可选值 默认值
title 二级导航菜单组名 string — —
icon 分组图标
待开发
string — —
url 点击组名跳转地址。
待开发
string — —
rank 衔头图标,即组标题右侧图标。 string — —
rows 二级菜单列表的最多显示行数。超过设置行数,自动向右扩展 number — —
children 二级导航菜单列表 array<object> —

Option of Children's Children Config

参数 说明 类型 可选值 默认值
cover 二级菜单封面。用于显示图片
注:尺寸不可设置,建议通过样式覆盖
string — —
title 二级菜单名称 string — —
icon 二级菜单图标 string — —
url 跳转地址 string — —

Header-Search 搜索框

搜索框。Header-Search组件是Header组件的子组件,也可独立使用

基本用法

<template>
    <muz-header-search :prefixIcon="prefixIcon" :suffixIcon="suffixIcon" :findList="findList" :historyList="historyList" :hotList="hotList" :cartoon="cartoon" @change="searchChange" @search="onSearch" />
</template>

<script>
export default {
    data: () => ({
        prefixIcon: 'https://xxxx.png',
        suffixIcon: 'https://xxxx.png',
        placeholder: '搜索',
        value: '搜索的值',
        hotList: [
            {text: '构建新时代中塞命运共同体'}
        ],
        historyList: [
            {text: '搜索历史'},
            {text: '老外被中国人的约饭节奏震惊了热'}
        ],
        findList: [
            {text: '中国人'},
            {text: '老外被中国人的约饭节奏震惊了热'}
        ],
        cartoon: true,
    })
    methods:{
        searchChange(value){

        },
        onSearch(value){

        },
    }

}
</script>

muz-header-search Attributes

参数 说明 类型 可选值 默认值
prefixIcon 前置图标 String — 搜索图标
suffixIcon 后置图标 String — 搜索图标
placeholder 当没有值设定时,出现在表单控件上的文字 String — 搜索
value 输入框的值 String — null
historyList 搜索历史 Array — —
hotList 热门搜索 Array — —
likenessList 搜索到内容 Array — —
cartoon 获取焦点时是否展开 Boolean true false

muz-header-search Events

事件称名 说明 返回参数
search 当点击前置图标时返回文本 e=text
change 输入值发生变化 e=text

Detail 详情区

详细区。比较基础的单一功能,用来代Muz-Item复杂的配置

基本用法

<template>
    <muz-detail :detail="detail" ></muz-detail>
</template>

<script>
export default {
    data: () => ({
        detail: {
            url: 'http://i.muztak.cn/images/yellow-river.jpg',
            title: '黄河之壶口瀑布',
        },
    }),
};
</script>

Muz-Detail Attributes

参数 说明 类型 可选值 默认值
config 详细配置 object — —
detail 详细数据 object — —
base-fields 基础字段 array<object> — —
danmu-list 弹幕列表。待开发! array<object> — —

Option of Config

参数 说明 类型 可选值 默认值
priceLabel 价格标签 string 项目预算 —
priceUnit 价格单位 string 万元 —
appendTitle 附加区标题 string 说明 —
appendContent 附加区内容 string<html> — —

Option of Detail

参数 说明 类型 可选值 默认值
publish_time 发布时间 string — —
title 标题 string — —
cover 封面 string — —
video 视频 string — —
content 内容 string<html> — —
summary 摘要 string — —
photos 照片集 array<object> — —
files 文件集 array<object> — —
link 来原链接 string — —
author 作者 string — —
price 价格 string — —
category_name 类别名称 string — —
classify_name 分类名称 string — —
user_name 用户名 string — —
avatar 头像 string
province 省 string — —
city 市 string — —
district 区 string — —
tags 标签组 string — —
nickname 昵称 string — —
views 阅读数0 number — —
favorites 收藏数 number — —
likes 点赞数 number — —

Option of Base-Fields

参数 说明 类型 可选值 默认值
field 字段名称 string — —

Swiper 轮播区

轮播图。目前适用于移动端

基本用法

<template>
    <muz-swiper :cover="cover" :video="video" :photos="photos" ></muz-swiper>
</template>

<script>
export default {
    data: () => ({
        cover: 'https://oss.muztak.cn/i/landscape-arctic.jpg',
        video: 'https://oss.muztak.cn/i/landscape-arctic.mp4',
        photos: [
            {
                url: 'http://i.muztak.cn/images/yellow-river.jpg',
                title: '黄河之壶口瀑布',
            },
            {
                url: 'http://i.muztak.cn/images/landscape-sakura.jpg',
                title: '樱花背景',
            },
        ]
    }),
};
</script>

Muz-Swiper Attributes

参数 说明 类型 可选值 默认值
cover 封面地址 string — —
video 视频地址。如设置cover,视频将使用cover做为视频封面 string — —
photos 图片列表 array<object> — —
danmuList 弹幕列表。待开发! array<object> — —

Option of Photos

参数 说明 类型 可选值 默认值
title 图片标题 string — —
url 图片地址 string — —

Poster 海报区

海报图。目前适用于移动端

Poster 海报区

基本用法

<template>
    <muz-poster :title="title" :cover="cover" :video="video" :photos="photos" ></muz-poster>
</template>

<script>
export default {
    data: () => ({
        title: '风景欣赏',
        cover: 'https://oss.muztak.cn/i/landscape-arctic.jpg',
        video: 'https://oss.muztak.cn/i/landscape-arctic.mp4',
        photos: [
            {
                url: 'http://i.muztak.cn/images/yellow-river.jpg',
                title: '黄河之壶口瀑布',
            },
            {
                url: 'http://i.muztak.cn/images/landscape-sakura.jpg',
                title: '樱花背景',
            },
        ]
    }),
};
</script>

Muz-Poster Attributes

参数 说明 类型 可选值 默认值
title 标题。当未设置图片标题时,默认的标题 string — —
cover 封面地址 string — —
video 视频地址。如设置cover,视频将使用cover做为视频封面 string — —
photos 图片列表 array<object> — —
danmuList 弹幕列表。待开发! array<object> — —

Option of Photos

参数 说明 类型 可选值 默认值
title 图片标题 string — —
url 图片地址 string — —

自动化渲染组件

List-Area 列表区渲染

该组件基于 muz-item 进行列表区域渲染,自动请求相关数据。

基本用法

<template>
    <muz-list-area :config="it.config" :request="request" :options-request="optionsRequest" :page="request.page" :limit="request.limit" :item-template="itemTemplate" :item-function="itemFunction" />
</template>

<script>
export default {
    components: {
        MuzItem: () => 'muz-item', // 注:微信小程序不支持此组件懒加载方式
    },
    data: () => ({
        config: {},
        request: {
            url: '/api/news_list',
            rootUrl: 'http://xx.cn',
            method: 'GET',
            param: {},
            headers: {},
            page: 1,
            limit: 10,
            showMore: false,
            nodeStatus: 'err',
            nodeStatusValue: 0,
            nodeData: 'data.list',
        },
    }),
};
</script>

List-Area Attributes

参数 说明 类型 可选值 默认值
classes 自定义类名 string — —
styles 自定义样式 object — —
page 当前页数
注:哆啦 A 梦需在 request 配置
number — 1
limit 每页限制条数
注:哆啦 A 梦需在 request 配置
number — 10
config 列表区配置 object — —
page-param 传入页面参数,用于定制化不同页面过滤结果 object — —
list 初始列表 array<object> — —
append-list 追加列表。组件监听追加列表变化,并触发重新渲染。 array<object> — —
item-template 条数据模版。
详见:Item 条数据
object — —
item-template-set 条数据模版集合。
item-template 的集合,常用配置多展示样式
object {news: ...} —
item-function 条数据函数。
编历每条数据时调用该函数序列化为 muz-item 配置。
function function(item){
return {title: xxx}
}
—
request 组件数据请求配置
详见:Option of Request
object,
function 待加
— —
options-request 多组选项的请求配置
详见:Option of Options-Request
array<object> — —
item-templates-request 条数据模版集请求配置
详见:Option of Item-Templates-Request
array<object> — —
extend-options-param 扩展选项参数 object — —

Option of Config

参数 说明 类型 可选值 默认值
debug 开启调试,控制台输出序列化结果 boolean true false
onClickUrl 点击跳转地址 string — —
nodeTemplate
适用:item-template-set,
item-templates-request
条数据展示模板的节点键名 string — show
openCheck 启用选框 boolean true false
nodeKey 主键节点名 string — —
emits 信号触发后的配置集 object<emit, object> {click: {url: ...}} —
contentNoMoreText 配置无更多数据时候的文字 string — —

Option of Request

  • 适用于 request 请求属性
  • 适用于 optionsRequest 选项列表请求属性
  • 适用于 itemTemplatesRequest 条数据模板请求属性
参数 说明 类型 可选值 默认值
rootUrl 根域名或 IP 地址。
建议:结尾不要加"/"。在 App、小程序等非代理模式时用。
string — —
url 请求地址。
建议:省略域名时应以"/"开头,与 rootUrl 拼接完整地址。
string — —
method 请求方法 string GET, POST, PUT, DELETE GET
param 请求参数 object — —
headers 自定义请求头。
注意:1、Web 端 GET 为Content-Type: '',即删除键
小程序端 GET 为Content-Type: application/text
所有 POST 为Content-Type: application/json
2、Web 端为authorization,小程序端为Authorization
object 例:{
authorization: xxx
}
—
showMore 是否显示更多 boolean false true
page
适用:Request 选项
当前页数 number — 1
limit
适用:Request 选项
每页限制条数 number — 10
options_key
适用:Options-Request 选项
指定创建的数据选项节点键名
注:不要与条数据已存在的键名冲突,
该值将在遍历序列化时追添至条数据。
options_key 例:category_options —
templateName
适用:Item-Templates-Request
自定义模块展示名称(节点值) string 例:news —
nodeStatus 响应的状态码节点键名 string — err
nodeStatusValue 响应的状态码成功的键值 string — 0
nodeData 响应的结果数据节点键名 string 例:data.list data
nodeTemplate
删除!!!
适用:Item-Templates-Request
条数据展示模板的节点键名
20230325 删除,移到主 config 中了
string — show
needToken 是否需要令牌(Token)
仅支持 Bearer 令牌
boolean true false
tokenKey 从缓存中获取 Token 令牌的键名 string — token
storage 从缓存中获取用户信息 array ["user_info"]

注:node 节点键名支持对象操作符"."点、支持数组操作符"[],支持多层子树。"

Option of Emits in Config

参数 说明 类型 可选值 默认值
url 跳转地址 string — —

Event

事件名称 说明 回调参数
item 点击条数据任一位置触发 item - 当前条数据参数
注:这点与 muz-item 不同
emit 条数据的自定义事件触发。
注意:自定义事件默认会关闭条数据的"item"冒泡事件,并使条数据的 onClickUrl 属性失效,此时需要通过配置条数据的 config.url 属性来设置新 url。如果希望恢复冒泡事件,设置条数据配置 cancelBubble 属性为 false,那时 onClickUrl 和新 url 都会生效,当然这种需求十分少见。
({emit, config, node}, param)
{信号名, 信号配置, 触发节点}, 当前条数据参数
ready 页面全部加载完成时触发 若有 muz-item-area,则返回 rawItem,其它 为无返回参数

Item-Area 条数据区渲染

该组件基于 muz-item 进行条数据区域渲染,自动请求相关数据。

基本用法

<template>
    <muz-item-area :config="it.config" :request="concatObject(it.request, 'param', this.pageParam)" :options-request="it.optionsRequest" :item-template="it.item" />
</template>

<script>
export default {
    components: {
        MuzItemArea: () => 'muz-item-area',  // 注:微信小程序不支持此组件懒加载方式
    },
    data: () => ({
        // 与muz-list-area相同
        ...
    })
}
</script>

Item-Area Attributes

参数 说明 类型 可选值 默认值
config 条数据配置 object — —
page 当前页数
注:哆啦 A 梦需在 request 选项
number — 1
limit 每页限制条数
注:哆啦 A 梦需在 request 选项
number — 10
request 组件数据请求配置
详见:List-Area 列表区渲染
object — —
options-request 多组选项的请求配置
详见:List-Area 列表区渲染
array<object> — —
item-template
或 item
条数据模版。
详见:Item 条数据
object — —

Chat-List 聊天列表

聊天记录列表,待开发

  • 基本使用
<muz-chat-list :list="list" />

<script>
export default{
    data: () => ({
        list: [
            {user_id:01 ,author/nickname: '想摆烂',avatar:'(http://i.cn/1111.jpg)' ,mode: 'mine', type: 'text', content: '每天为这几个臭钱而奔波', Url:'',timestamp: 1651212271},

            {user_id:02 ,author/nickname: '海琴烟',avatar:'(http://i.cn/1111.jpg)' ,mode: 'their', type: 'video', content: '我饿了!', Url:'[](http://i.cn/1111.mp4)',timestamp: 1651212282},

            {user_id:01 ,author/nickname: '想摆烂',avatar:'(http://i.cn/1111.jpg)' ,mode: 'their', type: 'image', content: '我饿了!',Url:'[](http://i.cn/1111.jpg)' ,timestamp: 1651212290},

            {user_id:02 ,author/nickname: '海琴烟',avatar:'(http://i.cn/1111.jpg)' ,mode: 'mine', type: 'sound', content: '饿,巨饿',Url:'http://i.cn/1111.mp3' ,timestamp: 1651215871},

        ],
    })
}
</script>
  • list 属性
参数 说明 类型 默认值 可选值
user_id 用户唯一标识 number - -
author/nickname 用户发送的消息 string - -
avatar 用户头像 string - -
mode 自己/对方 sting - mine/their
type 用户输入的类型 string - text,video,image,sound
  • mode 属性
参数 说明 类型 默认值 可选值
mine 自己 string -
their 对方 string -
  • type 属性
参数 说明 类型 默认值 可选值
text 纯文本 string - -
video 视频 string - -
image 图片 string - -
sound 语音 string - -
  • Props 属性
参数 说明 类型 默认值 可选值
list 数据表头 Array[Object, ...] 见下表 见下表
formData 生成 key-value 对象。需 sync Object {headers.key:headers.value} /
onlyRead 表单只读 Boolean false true
  • headers 属性中的字段数据(Item)参数
键 说明 类型 必选 默认值 可选值
key 键名 String 是 / 例:"sex"
label 标签文字 String 否 / 例:"姓名"
value 值 String|Array 否 / /
/**
 * function XTemplateString::format 对模板字符串进行编译,格式化为结果字符串
 * @param {object} item 给定需要格式化的Key-Value对象。
 * @param {string} text 要格式化的字符串文本
 * @desc
 * @return {string} 格式化完成后字符串
 * @example
 *   模板语法糖:
 *   一、基础版——直接引用值。语法:{{key}}
 *   例子:
 *       param={category_id: 35, category_value: "杭州西湖区"};
 *       str="类别ID:{{category_id}},类别值:{{category_value}}。";
 *       XTemplateString.format(param, str);
 *       结果 ==> "类别ID:35,类别值:杭州西湖区。"
 *   二、高级版——管道选项值。即指定列表对象、标签键、值键,找到引用值。语法:{{valueKey:key|options[labelKey]}}
 *   例子:
 *       param={category_id: 35, category_list: [{value: 27, label: "杭州上城区"}, {value: 35, label: "杭州西湖区"}]};
 *       str="类别:{{ value: category_id | category_list[label] }}"
 *       XTemplateString.format(param, str);
 *       结果 ==> "类别:杭州西湖区。"
 *   三、高级版——强制转换值。即指定来源键、目标键,生成数组对象。语法:{{(Array<targetKey:sourceKey>)valueKey)}}
 *   例子:
 *       param={photo_list: [{link: '/images/a.jpg', label: "杭州上城区"}, {link: '/images/b.jpg', label: "杭州西湖区"}]};
 *       str="{{ (Array< url: link, text: label >)photo_list }}"
 *       str2="{{ (Array< :link >)photo_list }}"
 *       XTemplateString.format(param, str);
 *       结果 ==> "[{url: '/images/a.jpg', text: "杭州上城区"}, {url: '/images/b.jpg', text: "杭州西湖区"}]"
 *       XTemplateString.format(param, str2);
 *       结果 ==> "['/images/a.jpg', '/images/b.jpg']"
 */

版本说明

V3.0.1.20230302-alpha

正式发布支持 Vue3 版本的 Muz-Doraemon 组件。

参考文献

uni-list 组件

app 端 nvue 专用组件。在 app-nvue 下,如果是长列表,使用 list 组件的性能高于使用 view 或 scroll-view 的滚动。原因在于 list 在不可见部分的渲染资源回收有特殊的优化处理。

原生渲染的资源回收机制,与 webview 渲染不同。webview 不需要数据有规则格式,长页面处于不可视的部分,其渲染资源会自动回收,除非 webview 使用区域滚动而不是页面滚动。所以 vue 页面只要不用 scroll-view,就不需要关注这个问题。而原生渲染则必须注意。

如果需要跨端,建议使用 uni-ui 的 uni-list 组件,它会自动处理 webview 渲染和原生渲染的情况,在 app-nvue 下使用 list 组件,而在其他平台则使用页面滚动。详见https://ext.dcloud.net.cn/plugin?id=24

隐私、权限声明

1. 本插件需要申请的系统权限列表:

无

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

无

许可协议

MIT协议

暂无用户评论。