10 examples of 'vuejs redirect' in JavaScript

Every line of 'vuejs redirect' 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
57redirect(path, saveInHistory = false) {
58 if (DEBUG) console.log('ReactApp.redirect', path);
59 setTimeout(() => {
60 if (saveInHistory) {
61 this.history.replace(path);
62 } else {
63 this.history.push(path);
64 }
65 }, DEBUG ? 1000 : 0);
66}
63redirect (path) {
64 if (!this.aborted) {
65 this.aborted = true
66 if (typeof path === 'string') {
67 path = mapParams(path, this.to.params, this.to.query)
68 } else {
69 path.params = path.params || this.to.params
70 path.query = path.query || this.to.query
71 }
72 this.router.replace(path)
73 }
74}
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}
105assertVue: function assertVue() {
106 if (!_Vue$1) {
107 this.error('must call Vue.use(Vuet) before creating a store instance');
108 }
109},
169function isVUE(path, data) {
170 // If file unsaved, check if first non-whitespace character is <
171 if (path == "?") {
172 return data.match(/^\s*);
173 }
174 return isTypeAllowed("vue", path);
175}
238handleRedirect(item) {
239 if (item.key) {
240 router.locator.redirect(item.key);
241 }
242}
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}
25async act() {
26 this._globals.redirect(this.get('path'));
27}
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}

Related snippets