增加raw方法

pull/1/head 1.9.1
yutent 2023-04-21 15:26:27 +08:00
parent a456df0b53
commit 714d9ceb3b
3 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@bd/core", "name": "@bd/core",
"version": "1.9.0", "version": "1.9.1",
"type": "module", "type": "module",
"description": "百搭UI组件库的核心", "description": "百搭UI组件库的核心",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -714,14 +714,19 @@ export function render(value, container, options = {}) {
return part return part
} }
export const html = (strings, ...values) => { export function html(strings, ...values) {
return { return {
__dom_type__: HTML_RESULT, __dom_type__: HTML_RESULT,
strings, strings,
values values
} }
} }
export const svg = (strings, ...values) => { export function raw(str) {
let strings = [str]
strings.raw = strings
return html(strings)
}
export function svg(strings, ...values) {
return { return {
__dom_type__: SVG_RESULT, __dom_type__: SVG_RESULT,
strings, strings,

View File

@ -15,11 +15,11 @@ import {
__children__ __children__
} from './constants.js' } from './constants.js'
import { css, adoptStyles } from './css.js' import { css, adoptStyles } from './css.js'
import { render, html, svg } from './html.js' import { render, html, svg, raw } from './html.js'
import { animate, MODES } from './anim.js' import { animate, MODES } from './anim.js'
import { nextTick, fire, bind, unbind, hyphen } from './utils.js' import { nextTick, fire, bind, unbind, hyphen } from './utils.js'
export { $, $$, offset, outsideClick, clearOutsideClick } from './utils.js' export { $, $$, offset, outsideClick, clearOutsideClick } from './utils.js'
export { html, css, svg, bind, unbind, nextTick, fire } export { html, raw, css, svg, bind, unbind, nextTick, fire }
// 简单的类名解析 // 简单的类名解析
export function classMap(data = {}) { export function classMap(data = {}) {