vuep icon indicating copy to clipboard operation
vuep copied to clipboard

关于解析的问题

Open xsdlr opened this issue 8 years ago • 4 comments

我看源码里解析template部分时会判断script标签是否在末尾并补全,我想问一下这么设计的原因,难道不考虑有些人的书写习惯会将style放在末尾

xsdlr avatar Aug 01 '17 10:08 xsdlr

因为浏览器兼容性问题,在处理 <template></template> 效果不一致。。

<template>
<script>
 console.log(1)
</script>
</template>

在 Chrome 下调用 innerHTML 返回的结果是 <script>console.log(1)

QingWei-Li avatar Aug 01 '17 10:08 QingWei-Li

感谢你的热心回答,之前可能我没表达清楚,我指的是vuep的template属性,比如在左边的编辑器区域输入以下代码

<template></template>
<script></script>
<style></style>

由于在解析步骤中的这步处理将会自动补全,造成格式错误 我希望知道的是这个设计的原因

xsdlr avatar Aug 02 '17 02:08 xsdlr

对 我回答的就是你这个问题,我设想的用法是 style > template > script 然后末尾的 script 可能会被一些浏览器忽略掉,所以我手动加了 script 闭合标签。没考虑到你的这个问题,那应该是 bug

QingWei-Li avatar Aug 02 '17 02:08 QingWei-Li

I have used v-model, and :template to set the source code for the vuep component and It still adds the tag at the end of the content. This 这步处理 isn't what I expect.

@QingWei-Li What browsers have the behavior where you need to append the tag ?

loops-and-spells avatar Apr 05 '18 03:04 loops-and-spells