1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2025-07-27 22:19:33 +08:00

update: check vant

This commit is contained in:
shangbin 2021-12-14 16:01:23 +08:00
parent 6b848ea950
commit 8e3c577302
9 changed files with 139 additions and 142 deletions

View File

@ -394,6 +394,7 @@ export default {
z-index: 3; z-index: 3;
top: 0; top: 0;
background: white; background: white;
overflow: scroll;
} }
#mountedEle { #mountedEle {

View File

@ -39,6 +39,7 @@ const defaultOptions = {
attrValueProcessor: function (a) { attrValueProcessor: function (a) {
return a; return a;
}, },
singleTags: [],
attributeProtectArray: [] // 哪些属性的值为''但需要渲染出来默认如果value为''就不生成key=value只生成key attributeProtectArray: [] // 哪些属性的值为''但需要渲染出来默认如果value为''就不生成key=value只生成key
}; };
@ -54,6 +55,7 @@ const props = [
'supressEmptyNode', 'supressEmptyNode',
'tagValueProcessor', 'tagValueProcessor',
'attrValueProcessor', 'attrValueProcessor',
'singleTags',
'attributeProtectArray' 'attributeProtectArray'
]; ];
@ -116,11 +118,11 @@ Parser.prototype.j2x = function (jObj, level) {
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
} else if (jObj[key] instanceof Date) { } else if (jObj[key] instanceof Date) {
val += this.buildTextNode(jObj[key], key, '', level); val += this.buildTextNode(jObj[key], key, '', level);
} else if (key === '__children'){ // 生成子节点 } else if (key === '__children') { // 生成子节点
const item = jObj[key]; const item = jObj[key];
if(item instanceof Array){ if (item instanceof Array) {
item.forEach(i =>{ item.forEach(i => {
const result = this.j2x(i, level + 1); const result = this.j2x(i, level + 1);
val += result.val; val += result.val;
}); });
@ -144,7 +146,7 @@ Parser.prototype.j2x = function (jObj, level) {
if (attr) { if (attr) {
if (typeof jObj[key] === "boolean" && jObj[key]) { if (typeof jObj[key] === "boolean" && jObj[key]) {
attrStr += ` ${key} `; attrStr += ` ${key} `;
} else if(jObj[key] || this.options.attributeProtectArray.includes(key)){ } else if (jObj[key] || this.options.attributeProtectArray.includes(key)) {
attrStr += ' ' + key + '="' + this.options.attrValueProcessor('' + jObj[key]) + '"'; attrStr += ' ' + key + '="' + this.options.attrValueProcessor('' + jObj[key]) + '"';
} else { } else {
attrStr += ' ' + key; attrStr += ' ' + key;
@ -234,7 +236,7 @@ function replaceCDATAarr(str, cdata) {
function buildObjectNode(val, key, attrStr, level) { function buildObjectNode(val, key, attrStr, level) {
if (attrStr && !val.includes('<')) { if (attrStr && !val.includes('<')) {
if (key === "img" || key === "input") { if (key === "img" || key === "a-icon" || key === "input" || (this.options.singleTags && this.options.singleTags.includes(key))) {
return (this.indentate(level) + '<' + key + attrStr + '/>'); return (this.indentate(level) + '<' + key + attrStr + '/>');
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,16 +9,10 @@
<van-button lc-mark type="warning" lc_id="B2mwHpjnn4">警告按钮</van-button> <van-button lc-mark type="warning" lc_id="B2mwHpjnn4">警告按钮</van-button>
<van-button lc-mark type="danger" lc_id="g8aJMV07tv">危险按钮</van-button> <van-button lc-mark type="danger" lc_id="g8aJMV07tv">危险按钮</van-button>
<van-button lc-mark plain type="primary" lc_id="B6Z0HCAfII">朴素按钮</van-button> <van-button lc-mark plain type="primary" lc_id="B6Z0HCAfII">朴素按钮</van-button>
<van-button lc-mark plain type="primary" lc_id="Kl0A4kmfxN">朴素按钮</van-button>
<van-button lc-mark loading type="primary" lc_id="H7ASlo2i6q">
<van-button lc-mark loading type="primary" loading-type="spinner" lc_id="DYCEFZzcgc">
<van-button lc-mark loading type="primary" loading-text="加载中..." lc_id="SS7BJIzMsg">
<van-button lc-mark square type="primary" lc_id="S7BYt/eLuR">方形按钮</van-button> <van-button lc-mark square type="primary" lc_id="S7BYt/eLuR">方形按钮</van-button>
<van-button lc-mark round type="primary" lc_id="xqEMwr1sRA">圆形按钮</van-button> <van-button lc-mark round type="primary" lc_id="xqEMwr1sRA">圆形按钮</van-button>
<van-button lc-mark icon="plus" type="primary" lc_id="7ja7xPbWmm">
<van-button lc-mark icon="plus" type="primary" lc_id="XG3GYBBrEU">按钮</van-button> <van-button lc-mark icon="plus" type="primary" lc_id="XG3GYBBrEU">按钮</van-button>
<van-button lc-mark icon="https://img.yzcdn.cn/vant/user-active.png" type="primary" lc_id="X//pnSGqLF"> <van-button lc-mark icon="https://img.yzcdn.cn/vant/user-active.png" type="primary" lc_id="X//pnSGqLF">按钮</van-button>
按钮</van-button>
<van-button lc-mark type="primary" size="large" lc_id="pwjoF9kQPG">大号按钮</van-button> <van-button lc-mark type="primary" size="large" lc_id="pwjoF9kQPG">大号按钮</van-button>
<van-button lc-mark type="primary" size="normal" lc_id="1ShXXx6uM0">普通按钮</van-button> <van-button lc-mark type="primary" size="normal" lc_id="1ShXXx6uM0">普通按钮</van-button>
<van-button lc-mark type="primary" size="small" lc_id="NJoWdzL3ps">小型按钮</van-button> <van-button lc-mark type="primary" size="small" lc_id="NJoWdzL3ps">小型按钮</van-button>
@ -26,12 +20,7 @@
<van-button lc-mark type="primary" block lc_id="0MRQ5LCYcF">块级元素</van-button> <van-button lc-mark type="primary" block lc_id="0MRQ5LCYcF">块级元素</van-button>
<van-button lc-mark color="#7232dd" lc_id="nrrWnpVDmN">单色按钮</van-button> <van-button lc-mark color="#7232dd" lc_id="nrrWnpVDmN">单色按钮</van-button>
<van-button lc-mark color="#7232dd" plain lc_id="l0tFmVZGj9">单色按钮</van-button> <van-button lc-mark color="#7232dd" plain lc_id="l0tFmVZGj9">单色按钮</van-button>
<van-button lc-mark color="linear-gradient(to right, #ff6034, #ee0a24)" lc_id="RXwG5PrfLY">渐变色按钮 <van-button lc-mark color="linear-gradient(to right, #ff6034, #ee0a24)" lc_id="RXwG5PrfLY">渐变色按钮</van-button>
</van-button>
</van-button>
</van-button>
</van-button>
</van-button>
</div> </div>
</div> </div>
<div lc_id="an/3DkuLE6"> <div lc_id="an/3DkuLE6">
@ -49,7 +38,7 @@
</van-cell-group> </van-cell-group>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
@ -57,12 +46,10 @@ export default {
}, },
methods: {}, methods: {},
}; </script> }; </script>
<style scoped> <style scoped>button + button {
button + button {
margin-top: 10px; margin-top: 10px;
} }
#vant-button > * { #vant-button > * {
margin: 0 5px 5px 0; margin: 0 5px 5px 0;
} }</style>
</style>

View File

@ -60,7 +60,7 @@
<div lc_id="mllWNtm7WD"> <div lc_id="mllWNtm7WD">
<div class="demonstration-vant" lc_id="XU1g37b7Bj">Skeleton 骨架屏</div> <div class="demonstration-vant" lc_id="XU1g37b7Bj">Skeleton 骨架屏</div>
<van-skeleton title :row="3" lc-mark lc_id="B9ypSupDLY"></van-skeleton> <van-skeleton title :row="3" lc-mark lc_id="B9ypSupDLY"></van-skeleton>
<br> <br lc_id="gJKqa1lhDD" />
<van-skeleton title avatar :row="3" lc-mark lc_id="LH6oqOei+U"></van-skeleton> <van-skeleton title avatar :row="3" lc-mark lc_id="LH6oqOei+U"></van-skeleton>
</div> </div>
<div lc_id="H2zy4AGqzd"> <div lc_id="H2zy4AGqzd">

View File

@ -11,8 +11,9 @@
</div> </div>
</div> </div>
<div lc_id="L5fPGRqjYZ"> <div lc_id="L5fPGRqjYZ">
<div class="demonstration-vant" lc_id="3qMdltHE4i">DatetimePicker 时间选择</div> <div class="demonstration-vant" lc_id="3qMdltHE4i">DatetimePicker 时间选择 </div>
<van-datetime-picker v-model="currentDate" type="date" title="选择年月日" lc-mark :min-date="minDate" :max-date="maxDate" lc_id="14vPN9ntBV"></van-datetime-picker> <van-datetime-picker v-model="currentDate" type="date" title="选择年月日" lc-mark :min-date="minDate"
:max-date="maxDate" lc_id="14vPN9ntBV"></van-datetime-picker>
</div> </div>
<div lc_id="ODgqdaL6ED"> <div lc_id="ODgqdaL6ED">
<div class="demonstration-vant" lc_id="hrPSBFZ6Hh">Checkbox 复选框</div> <div class="demonstration-vant" lc_id="hrPSBFZ6Hh">Checkbox 复选框</div>
@ -29,7 +30,7 @@
<van-checkbox name="b" lc_id="lNhFITM1W/">复选框 b</van-checkbox> <van-checkbox name="b" lc_id="lNhFITM1W/">复选框 b</van-checkbox>
<van-checkbox lc-mark name="c" lc_id="BVLbIHoPpi">复选框 c</van-checkbox> <van-checkbox lc-mark name="c" lc_id="BVLbIHoPpi">复选框 c</van-checkbox>
</van-checkbox-group> </van-checkbox-group>
<br> <br lc_id="lEi0tbIvkM" />
<van-button type="primary" size="small" @click="checkAll" lc_id="azfVg1jydO">全选</van-button> <van-button type="primary" size="small" @click="checkAll" lc_id="azfVg1jydO">全选</van-button>
<van-button plain size="small" @click="toggleAll" lc_id="FxjbFUMiWD">反选</van-button> <van-button plain size="small" @click="toggleAll" lc_id="FxjbFUMiWD">反选</van-button>
</div> </div>
@ -41,7 +42,7 @@
<van-radio name="1" lc_id="eX5Wd5A8M+">单选框 1</van-radio> <van-radio name="1" lc_id="eX5Wd5A8M+">单选框 1</van-radio>
<van-radio lc-mark name="2" lc_id="QN9H1HdL7S">单选框 2</van-radio> <van-radio lc-mark name="2" lc_id="QN9H1HdL7S">单选框 2</van-radio>
</van-radio-group> </van-radio-group>
<br> <br lc_id="5uaRLSgQ+B" />
<van-radio-group lc-mark v-model="radio10" lc_id="p/WdWJotYb"> <van-radio-group lc-mark v-model="radio10" lc_id="p/WdWJotYb">
<van-cell-group lc_id="7SU7k9W/RI"> <van-cell-group lc_id="7SU7k9W/RI">
<van-cell title="单选框 1" clickable @click="radio10 = '1'" lc-mark lc_id="cu2BQ/D1Gt"> <van-cell title="单选框 1" clickable @click="radio10 = '1'" lc-mark lc_id="cu2BQ/D1Gt">
@ -59,7 +60,7 @@
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {

View File

@ -36,15 +36,12 @@
</div> </div>
<div lc_id="HFSjLBSjr4"> <div lc_id="HFSjLBSjr4">
<div class="demonstration-vant" lc_id="5zilvW7BTu">ActionBar 动作栏</div> <div class="demonstration-vant" lc_id="5zilvW7BTu">ActionBar 动作栏</div>
<div style="position: relative;" lc-mark lc_id="LywB4w//P/"> <div style="position: relative;" lc-mark lc_id="Pt76lmgRrB">
<van-action-bar lc_id="44C1zLHqlz"> <van-action-bar lc_id="9ToRhiLix2">
<van-action-bar-icon icon="chat-o" text="客服" @click="onClickIcon" lc_id="2rUDSvAMip"> <van-action-bar-icon icon="chat-o" text="客服" @click="onClickIcon" lc_id="+KLvcHu+dq"></van-action-bar-icon>
<van-action-bar-icon icon="cart-o" text="购物车" @click="onClickIcon" lc_id="MAju6gwdil"> <van-action-bar-icon icon="cart-o" text="购物车" @click="onClickIcon" lc_id="jmPWsraNbw"></van-action-bar-icon>
<van-action-bar-icon icon="shop-o" text="店铺" @click="onClickIcon" lc_id="gSY/APPOCK"> <van-action-bar-icon icon="shop-o" text="店铺" @click="onClickIcon" lc_id="9nvKcSlBKx"></van-action-bar-icon>
<van-action-bar-button type="danger" text="立即购买" @click="onClickButton" lc_id="iHUXW5cxjd"></van-action-bar-button> <van-action-bar-button type="danger" text="立即购买" @click="onClickButton" lc_id="SxUbF/TzkY"></van-action-bar-button>
</van-action-bar-icon>
</van-action-bar-icon>
</van-action-bar-icon>
</van-action-bar> </van-action-bar>
</div> </div>
</div> </div>
@ -149,7 +146,15 @@ export default {
:v-deep(.van-submit-bar) { :v-deep(.van-submit-bar) {
position: initial; position: initial;
} }
</style>
<style>
.van-action-bar { .van-action-bar {
position: relative; position: relative;
padding-bottom: 0; padding-bottom: 0;
}</style> }
.van-submit-bar {
z-index: 0;
}
</style>

View File

@ -239,6 +239,7 @@ async function compiler(path) {
format: true, format: true,
indentBy: " ", indentBy: " ",
supressEmptyNode: false, supressEmptyNode: false,
singleTags: ['br']
}; };
const parser = new Parser(defaultOptions); const parser = new Parser(defaultOptions);