10 examples of 'vuejs latest version' in JavaScript

Every line of 'vuejs latest version' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
72export function checkVueVersion (Vue: VueConstructor, requiredVue?: string) {
73 const vueDep = requiredVue || __REQUIRED_VUE__
74
75 const required = vueDep.split('.', 3).map(v => v.replace(/\D/g, '')).map(Number)
76 const actual = Vue.version.split('.', 3).map(n => parseInt(n, 10))
77
78 // Simple semver caret range comparison
79 const passes =
80 actual[0] === required[0] && // major matches
81 (actual[1] > required[1] || // minor is greater
82 (actual[1] === required[1] && actual[2] >= required[2]) // or minor is eq and patch is >=
83 )
84
85 if (!passes) {
86 consoleWarn(`Vuetify requires Vue version ${vueDep}`)
87 }
88}
4function createVue(el, vueComponent, vueProps) {
5 const nodeEl = document.createElement('div');
6 el.appendChild(nodeEl);
7 const app = Object.assign(new Vue(vueComponent), vueProps);
8 app.$mount(nodeEl);
9 return app;
10}
1function Vue(options){
2 var context = document.querySelector(options.el);
3 var html = context.innerHTML;
4 var data = options.data;
5 var regex = /(\{\{\s*([\w]+)\s*\}\})/g;
6 while(regex.exec(html)){
7 console.log(1)
8 html = html.replace(new RegExp(RegExp.$1, "g"), data[RegExp.$2]);// 只进来2次
9 //html = html.replace(RegExp.$1, data[RegExp.$2]);// 进来3次
10 // console.log(RegExp.$1 + ":"+ RegExp.$2);
11 }
12
13 context.innerHTML = html;
14}
45export function compileVue (source, componentName) {
46 return new Promise((resolve, reject) => {
47 if (!templateRE.test(source)) {
48 return reject('No Template!')
49 }
50 const scriptMatch = scriptRE.exec(source)
51 const script = scriptMatch ? scriptMatch[1] : ''
52 const templateMatch = templateRE.exec(source)
53 const compileOptions = {}
54 if (/\s*recyclable\=?/i.test(templateMatch[1])) {
55 compileOptions.recyclable = true
56 }
57 const res = compile(templateMatch[2], compileOptions)
58
59 const name = 'test_case_' + (Math.random() * 99999999).toFixed(0)
60 const generateCode = styles => (`
61 try { weex.document.registerStyleSheets("${name}", [${JSON.stringify(styles)}]) } catch(e) {};
62 var ${name} = Object.assign({
63 _scopeId: "${name}",
64 style: ${JSON.stringify(styles)},
65 render: function () { ${res.render} },
66 ${res['@render'] ? ('"@render": function () {' + res['@render'] + '},') : ''}
67 staticRenderFns: ${parseStatic(res.staticRenderFns)},
68 }, (function(){
69 var module = { exports: {} };
70 ${script};
71 return module.exports;
72 })());
73 ` + (componentName
74 ? `Vue.component('${componentName}', ${name});\n`
75 : `${name}.el = 'body';new Vue(${name});`)
76 )
77
78 let cssText = ''
79 let styleMatch = null
80 while ((styleMatch = styleRE.exec(source))) {
81 cssText += `\n${styleMatch[1]}\n`
82 }
83 styler.parse(cssText, (error, result) => {
84 if (error) {
85 return reject(error)
86 }
87 resolve(generateCode(result.jsonStyle))
88 })
89 resolve(generateCode({}))
90 })
91}
8function Vue (options) {
9 if (process.env.NODE_ENV !== 'production' &&
10 !(this instanceof Vue)
11 ) {
12 warn('Vue is a constructor and should be called with the `new` keyword')
13 }
14 this._init(options)
15}
26function Vue(options) {
27 var self = this; // 实例的对象赋值,防止后期对对象的更改
28 this.data = options.data;
29 this.methods = options.methods;
30
31 // 将data上面的属性代理到vm实例上
32 Object.keys(this.data).forEach(function(key) {
33 self.proxyKeys(key);
34 });
35
36 // 监听数据的变化
37 observe(this.data);
38 // 进行指令的编译
39 new Compile(options.el, this);
40
41 options.mounted.call(this); // 所有事情处理好后执行mounted函数
42}
101var getVueScript = function getVueScript(js, html) {
102 var scripts = js.split(/export\s+default/);
103 var scriptStrOrg = "(function() {".concat(scripts[0], " ; return ").concat(scripts[1], "})()");
104 var scriptStr = window.Babel ? window.Babel.transform(scriptStrOrg, {
105 presets: ['es2015']
106 }).code : scriptStrOrg;
107 var scriptObj = [eval][0](scriptStr);
108 scriptObj.template = html;
109 return scriptObj;
110};
3module.exports = function nuxtBootstrapVue (moduleOptions) {
4 // Conditionally require bootstrap original css too if not explicitly disabled
5 if (moduleOptions.css !== false) {
6 this.options.css.unshift('bootstrap/dist/css/bootstrap.css')
7 }
8
9 // Register plugin
10 this.addPlugin({
11 src: path.resolve(__dirname, 'plugin.js'),
12 fileName: 'bootstrap-vue.js',
13 moduleOptions
14 })
15
16 // Add library styles
17 this.options.css.push('bootstrap-vue/dist/bootstrap-vue.css')
18}
90export function mountWithDefaultsAndLocalVue (Component, localVue, options = {}) {
91 i18n.locale = 'en'
92 configureQuasar(localVue)
93
94 localVue.component('RouterLink', RouterLinkStub)
95 localVue.component('Transition', TransitionStub)
96 localVue.component('TransitionGroup', TransitionGroupStub)
97 localVue.directive('measure', {})
98 const datastore = options.datastore
99 delete options.datastore
100 const wrapper = mount(Component, {
101 localVue,
102 sync: false,
103 i18n,
104 store: datastore,
105 mocks: {
106 ...routerMocks,
107 },
108 ...options,
109 })
110 makeFindAllIterable(wrapper)
111 return wrapper
112}
105assertVue: function assertVue() {
106 if (!_Vue$1) {
107 this.error('must call Vue.use(Vuet) before creating a store instance');
108 }
109},

Related snippets