1 Star 0 Fork 1

CHINASOFT4_OHOS/ColorTextView

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
4年前
4年前
4年前
4年前
Loading...
README
Apache-2.0

# ColorTextView

项目介绍

  • 项目名称:ColorTextView
  • 所属系列:openharmony的第三方组件适配移植
  • 功能:给指定文字设置指定颜色
  • 项目移植状态:主功能完成
  • 调用差异:JS方式
  • 开发版本:sdk6,DevEco Studio2.2 Beta1
  • 基线版本:master

使用说明

  1.新建common/comp文件夹,将colorText.css,colorText.hml和colorText.js三个文件拷贝进去
  
  2.index.hml中引入组件<color-text></color-text>,从index.js中传入content
  <element name="color-text" src="../../common/comp/colorText.hml"></element>
  <div class="container">
      <color-text content="{{ content }}"></color-text>
  </div>

  3.index.js中传入需要设置的段落,通过this.$child("colorText").findAndSetStrColor()来给指定文字设置指定颜色
  export default {
       data: {
              /*展示文本*/
              content: `You can get 500 credits after connect and share the WIFI`,
          },
       onShow(){
           /*调用子组件设置颜色方法*/
           this.$child("colorText").findAndSetStrColor('You','#ff8000')
           this.$child("colorText").findAndSetStrColor('can','#008888')
           this.$child("colorText").findAndSetStrColor('500','#98FB98')
           this.$child("colorText").findAndSetStrColor('WIFI','#FF0000')
       }
  }

在sdk6,DevEco Studio2.2 Beta1下项目可直接运行,如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下

效果展示

测试信息

CodeCheck代码测试无异常

CloudTest代码测试无异常

病毒安全检测通过

当前版本demo功能与原组件基本无差异

版本迭代

  • 0.0.2-SNAPSHOT

版权与许可信息

    Copyright 2016 zhonghanwen

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

Copyright 2016 zhonghanwen Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

给指定文字设置指定颜色 展开 收起
README
Apache-2.0
取消

发行版

暂无发行版

ColorTextView 开源评估指数

productivity 生产力
niche_creation 创新力
robustness 稳健性
collaboration 协作
contributor 贡献者
software 软件

贡献者 (6)

全部

近期动态

4年前推送了新的提交到 master 分支,b4c9d5d...333248f
4年前合并了 PR #13 readme修改
4年前创建了 PR #13 readme修改
4年前推送了新的提交到 master 分支,91036b2...b4c9d5d
4年前合并了 PR #12 readme修改
加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chinasoft4_ohos/ColorTextView.git
git@gitee.com:chinasoft4_ohos/ColorTextView.git
chinasoft4_ohos
ColorTextView
ColorTextView
master

搜索帮助