# ColorTextView
**Repository Path**: chinasoft4_ohos/ColorTextView
## Basic Information
- **Project Name**: ColorTextView
- **Description**: 给指定文字设置指定颜色
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2021-06-02
- **Last Updated**: 2024-05-31
## Categories & Tags
**Categories**: harmonyos-textview
**Tags**: None
## README
# ColorTextView
## 项目介绍
- 项目名称:ColorTextView
- 所属系列:openharmony的第三方组件适配移植
- 功能:给指定文字设置指定颜色
- 项目移植状态:主功能完成
- 调用差异:JS方式
- 开发版本:sdk6,DevEco Studio2.2 Beta1
- 基线版本:master
## 使用说明
```
1.新建common/comp文件夹,将colorText.css,colorText.hml和colorText.js三个文件拷贝进去
2.index.hml中引入组件,从index.js中传入content
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.
```