From 714d9ceb3b96e19d015ebc8395dfd5e485faf780 Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 21 Apr 2023 15:26:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0raw=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/html.js | 9 +++++++-- src/index.js | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index acd4516..9cad53c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bd/core", - "version": "1.9.0", + "version": "1.9.1", "type": "module", "description": "百搭UI组件库的核心", "main": "dist/index.js", diff --git a/src/html.js b/src/html.js index 1a90758..474b47a 100644 --- a/src/html.js +++ b/src/html.js @@ -714,14 +714,19 @@ export function render(value, container, options = {}) { return part } -export const html = (strings, ...values) => { +export function html(strings, ...values) { return { __dom_type__: HTML_RESULT, strings, 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 { __dom_type__: SVG_RESULT, strings, diff --git a/src/index.js b/src/index.js index 028e655..5512a71 100644 --- a/src/index.js +++ b/src/index.js @@ -15,11 +15,11 @@ import { __children__ } from './constants.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 { nextTick, fire, bind, unbind, hyphen } 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 = {}) {