更新记录

v1.0.0(2023-11-29) 下载此版本

(2023.11.29): v1.0.0 - 初步实现核心方案


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.6.0 app-vue app-nvue × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

nvue 纯css文本自然换行组件方案1

  • 由于 nvue 的各种限制,要想实现文本自然换行效果,没 web 那么容易
  • 该组件提供了一种纯css实现的方案,如果有人需要,我下次再提供优化方案2
  • (工作之余做的,精力有限,若无关注和收益,自然也不会有动力继续做下去了)

案例代码

<template>
    <Layout>
            <Navbar></Navbar>
            <KlTextWrapRowsCv :list="list"></KlTextWrapRowsCv>
    </Layout>
</template>

<script>
    import Layout from '../../components/kl-text-wrap-rows-cv/layout.vue'
    import Navbar from '../../components/kl-text-wrap-rows-cv/navbar.vue'
    import KlTextWrapRowsCv from '../../components/kl-text-wrap-rows-cv/kl-text-wrap-rows-cv.vue'
    export default {
        components: {
            Layout,
            Navbar,
            KlTextWrapRowsCv
        },
        data() {
            const list = []
            const mockText = [
                "投币啦3连投币啦three money let's go投币啦3连投币啦three money let's go投币啦3连",
                "投币啦3连投币啦three money let's go投币啦3连投币啦three money let's g",
                "three money letthree money letthree money let",
                "three money letthree money letthree money let",
                "three money letthree money letthree money let"
            ]
            let text = ''
            for(let i=0; i<6; i+=1) {
                list.push({
                    key: `kltw-item-${i}`,
                    label: '爱看小电视:',
                    text:mockText[parseInt(1+Math.random()*3)],
                    leftTagList: [{
                        key: 'kl-item-tag-1',
                        type: 'food',
                        text: '100+KG',
                        img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAgNJREFUWEfFlo1NQzEMhN1JgEmASYBJgEmASYBJYBPQh3KV4/w4r0Xtkyo9vSa+s++ceGdnfnb/hH9Z4nxvjXcoAQDvzOym/DwuJD7M7NPMXjNCWwkI+MnMAPJgvEPo2sxYxzvfIPE8IrKFAAHfV4IWME8Wwl0SqwQETmlvs7KG/x/NTBW7intXCJDJV9F1K7jwFAM5HjyJFQKUnQANexdImlOhUSfcm9lLIbA3Z0ZAm8ic4P7xGscuGBmvSSYjoNJXZSsV4T+yxVzKKDOepNgnlBH4iSUrqZIJz8gTDZArUbV3RkDlR3uv6+h7NDjuZ230TvV9RkDtE9dgJJ4oSySgKsQE1NJ/cWcERkBoPz3dHBMkjAauiGUVgG3UGQ3piOHxGghMJZwRAJwq9DTsEYsSyCsRo5J2RmDkZH0fnu+uUzBv9Eol7aFtSHZk0vMCBAEZnZ6VhzICo1aK17KOYM0HZI534rHctHBGACCZrtd2fjDhXSdiz6DdCykjgJyz+2DLzax7oKrMCgFAtJkqxEtphQSeIJHmUlshoAoAjMaZ++ON6TNvyGcE4h0u9wOCzpoJIyh6MxtqEhpWbuUyYrOfbuMcIKdrKBWZdCCd3QXd6aUjtiahi9L3IvM2mYyqML0KrIKvmC9dEwmcFDxKcHLwSGA0fqVlPGZB1obHxF7ae3YCvw2ulyGA+jFVAAAAAElFTkSuQmCC',
                        styles: {
                            root: 'background-color:#aed5e9;',
                            text: 'color:black;'
                        }
                    },
                    {
                        key: 'kl-item-tag-2',
                        type: 'thing',
                        text: '10',
                        img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAgCAYAAACVU7GwAAAAAXNSR0IArs4c6QAAAoRJREFUWEelWItNAzEMtSeBTgKdBDoJ7SSUSSiTUCYxeqfk5Dh24kCk6qr2kry89/y5Y/rDEJFHInohoucyHdd7+Y7rjYi+mBnX5cHZGQrIOTunAL0y82VhDqVAicgbEa2AsRjAXhrcFJSIfCqZ7GaQR0sEGaukHjk3Zj7OWAtBFbnenU1w6gszX+3iIoL7X9XvAGxBYv6RmasHO4wjUJYhLHKKzFsO8a12gFwnEQFIyI/gqOPOzIeIMReUI9mUdmcO2NikLYBxSA0sXLMDVU4GGerIALKBsLGkmQiAnb3I9ECJXoyZh8EgIvAMWNDj4HnGkdiVsdnQCf1dAk//IFXM5sBjWomOVQsKRq26h7INIhOB0EWlE6U6iDq2dlCOl5oNVEbHSbVh654pQMX4lq2GXQ3KmlXnEQ/EHt6jVBHIjvV0+mgMr0HZxDdLvPjfjZ5oYmEbgfFgylZjFQ1K+2kEaKmOKbmeTLbXe6RA1ZoGmquMP6hzo/LgGBrzvVJlb23MHjG1JMtCutA+xPfq1RCUDtMud2QMVu9xCjP+2mQnog+wbe4J5dOgpqVlYGav1emYFxHt4YaEKCUMq/gAkM0/uNXN8CKiy1mYEmzuSCfDEmFeDYwAWfBNrRyVmSW2Rq3LpMyQLfoWlD1Bii2nUwgDxSlnnd8sKEiom7Fp61qks9Ug27p0LGG9TJM3BTaKJJUmvETqKhG1w/bkIbBZd1GY9ADl2+HBIm7Ns6CsaYNGcP3BQQGzzf6emWtvbTLzttmk95raYdZ/13cG3tOx12/hN3yiB9JUpZg+IRfW0ABGHWemLC61OylQSk68aVkBtwSmni4NStOhPAN566f6Ddd/vQr6BfEwkDAPCvKcAAAAAElFTkSuQmCC',
                        styles: {
                            root: 'background-color:#f38f2b;',
                            text: 'color: white;'
                        }
                    }],
                    rightImageList: [
                        {
                            key: 'kl-item-rimg-1',
                            img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIYAAABPCAYAAAAunr3tAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABfaVRYdFNuaXBNZXRhZGF0YQAAAAAAeyJjbGlwUG9pbnRzIjpbeyJ4IjowLCJ5IjowfSx7IngiOjEzNCwieSI6MH0seyJ4IjoxMzQsInkiOjc5fSx7IngiOjAsInkiOjc5fV19tCG1cwAAEV1JREFUeF7tnflzFNUWx08myWQPEJWETQEXQKAEfBVQeVCiVukDdyyr/MEq/5P3Z/gPPKu0Si1LQU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sy1BvlHEYOtC/qdxTWPPLJQ5s6bJ40zm8xkAJzePXv+a+QIay2+Q7i4I/bEGItwb0VYhJCsteTfHKG3+z9zhfrnGn4IDiTfESpg6J0VV/Ua0pKf8yzJY1Hy2XNn5fChw2amGE6vqKgc1jiFhIIiBr0egaPSASSh99oaiKzZwMwQPeAbYA4QPAtnuO6kQtC8YolXLzHHQWLWtftat5kWxjp4BpHNREPcuKGgiOFqPKzanSSYEs5BDjSEkwCi+DyGA3LhM0AOFvIyPkKegARBqEv+QFOEzE8BoeBMye0CogDIFDZDYFjYhKt2qbCEPx4KUw/eBiDDWEKAQtMAt4siMULEgAyeRmGI31OLKFOeGEXkRpEYReREkRhF5ESRGEXkRJEYReREkRhF5MQdEkPDu5LCmx8owiHyf8J94M/MI6yxAAAAAElFTkSuQmCC'
                        }
                    ]
                })
            }
            return {
                list
            }
        }
    }
</script>

隐私、权限声明

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

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

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

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问