Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const parser = require('mvvm-babel-parser');
const t = require('@babel/types');
const traverse = require('@babel/traverse')["default"];
const generate = require('mvvm-babel-generator/lib')["default"];
const _ = module.exports = {};
/* 将vue语法的模板转化为cml语法
主要是将
1 :id="value" => v-bind:id="value"
2 @click="handleClick" => c-bind:click="handleClick" 或者c-catch
*/
_.vueToCml = function(source,options = {}) {
// 去掉模板中的注释
source = _.preDisappearAnnotation(source);
// 模板中所有的 :id="value" ==> v-bind:id="value"
source = _.preParseBindAttr(source);
// 模板中所有的 @click="handleClick" => c-bind:click="handleClick"
source = _.preParseVueEvent(source);
// 模板通过 @babel/parser进行解析
const parser = require('mvvm-babel-parser');
const t = require('@babel/types');
const traverse = require('@babel/traverse')["default"];
const generate = require('mvvm-babel-generator/lib')["default"];
const _ = module.exports = {};
/* 将vue语法的模板转化为cml语法
主要是将
1 :id="value" => v-bind:id="value"
2 @click="handleClick" => c-bind:click="handleClick" 或者c-catch
*/
_.vueToCml = function(source,options = {}) {
// 去掉模板中的注释
source = _.preDisappearAnnotation(source);
// 模板中所有的 :id="value" ==> v-bind:id="value"
source = _.preParseBindAttr(source);
// 模板中所有的 @click="handleClick" => c-bind:click="handleClick"
source = _.preParseVueEvent(source);
// 模板通过 @babel/parser进行解析