vue.js v-html을 이용한 문자열에서 특정 글자색 바꾸기
vue.js로 문자열에서 특정 글자의 글자색을 바꿔야 하는 일이 생겼다. 원하는 글자를 span tag로 감싼뒤 style로 color를 주기로 했다. 우선 text는 computed로 받아오는 구조이다. (vue 2.0) computed에서 정규식을 통해 특정 글자를 찾고, 이를 span tag를 감싼다. 최종적으로 v-html을 통해 text를 출력한다.. v-html 이란? v-text innerText 속성에 연결됨. 태그 문자열을 HTML 인코딩하여 나타내기 때문에 화면에는 태그 문자열이 그대로 나타남. v-html innerHtml 속성에 연결됨. 태그 문자열을 파싱하여 화면에 나타냄. (XSS 공격 등에 취약함. 꼭 필요한 경우가 아니면 v-text 를 사용 추천.) __ 간단 예시__ te..
프론트엔드/Vue.js
2022. 10. 12. 13:48
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- react 3d
- react glsl
- vue ref
- typescript gsls
- three.js leva
- eslint
- 394 decode string
- vue
- react 3d animation
- webpack glsl
- react 3d text
- Vue.js
- vue react
- attempted import error: bvh_struct_definitions' is not exported from './gpu/bvhshaderglsl.js' (imported as 'bvhshaderglsl').
- next.js import glsl
- react leva
- leva
- ts glsl
- react ref reative
- vue3
- react vue
- react 3d 에니메이션
- react fiber 3d
- react three fiber
- 394. decode string js
- [leetcode] 394. decode string js
- react three fiber leva
- 394. decode string javascript
- vue reactive
- [leetcode] 394. decode string
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함