some test code and playing around
This commit is contained in:
parent
5bb20bd479
commit
cb913f6cea
File diff suppressed because one or more lines are too long
1
cookbook/static/vue/js/util.js
Normal file
1
cookbook/static/vue/js/util.js
Normal file
@ -0,0 +1 @@
|
||||
(function(e){function t(t){for(var r,c,i=t[0],l=t[1],f=t[2],p=0,s=[];p<i.length;p++)c=i[p],Object.prototype.hasOwnProperty.call(o,c)&&o[c]&&s.push(o[c][0]),o[c]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);a&&a(t);while(s.length)s.shift()();return u.push.apply(u,f||[]),n()}function n(){for(var e,t=0;t<u.length;t++){for(var n=u[t],r=!0,i=1;i<n.length;i++){var l=n[i];0!==o[l]&&(r=!1)}r&&(u.splice(t--,1),e=c(c.s=n[0]))}return e}var r={},o={util:0},u=[];function c(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,c),n.l=!0,n.exports}c.m=e,c.c=r,c.d=function(e,t,n){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},c.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,t){if(1&t&&(e=c(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(c.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)c.d(n,r,function(t){return e[t]}.bind(null,r));return n},c.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="";var i=window["webpackJsonp"]=window["webpackJsonp"]||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var f=0;f<i.length;f++)t(i[f]);var a=l;u.push([1,"chunk-vendors"]),n()})({"025e":function(e,t,n){"use strict";n.r(t),n.d(t,"myCustomTestFunction",(function(){return r}));n("e260"),n("e6cf"),n("cca6"),n("a79d");function r(e){console.log(e)}},1:function(e,t,n){e.exports=n("025e")}});
|
@ -1,91 +1 @@
|
||||
(function (e) {
|
||||
function r(r) {
|
||||
for (var n, c, l = r[0], a = r[1], p = r[2], f = 0, s = []; f < l.length; f++) c = l[f], Object.prototype.hasOwnProperty.call(o, c) && o[c] && s.push(o[c][0]), o[c] = 0;
|
||||
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n]);
|
||||
i && i(r);
|
||||
while (s.length) s.shift()();
|
||||
return u.push.apply(u, p || []), t()
|
||||
}
|
||||
|
||||
function t() {
|
||||
for (var e, r = 0; r < u.length; r++) {
|
||||
for (var t = u[r], n = !0, l = 1; l < t.length; l++) {
|
||||
var a = t[l];
|
||||
0 !== o[a] && (n = !1)
|
||||
}
|
||||
n && (u.splice(r--, 1), e = c(c.s = t[0]))
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
var n = {}, o = {vue_app_01: 0}, u = [];
|
||||
|
||||
function c(r) {
|
||||
if (n[r]) return n[r].exports;
|
||||
var t = n[r] = {i: r, l: !1, exports: {}};
|
||||
return e[r].call(t.exports, t, t.exports, c), t.l = !0, t.exports
|
||||
}
|
||||
|
||||
c.m = e, c.c = n, c.d = function (e, r, t) {
|
||||
c.o(e, r) || Object.defineProperty(e, r, {enumerable: !0, get: t})
|
||||
}, c.r = function (e) {
|
||||
"undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(e, "__esModule", {value: !0})
|
||||
}, c.t = function (e, r) {
|
||||
if (1 & r && (e = c(e)), 8 & r) return e;
|
||||
if (4 & r && "object" === typeof e && e && e.__esModule) return e;
|
||||
var t = Object.create(null);
|
||||
if (c.r(t), Object.defineProperty(t, "default", {
|
||||
enumerable: !0,
|
||||
value: e
|
||||
}), 2 & r && "string" != typeof e) for (var n in e) c.d(t, n, function (r) {
|
||||
return e[r]
|
||||
}.bind(null, n));
|
||||
return t
|
||||
}, c.n = function (e) {
|
||||
var r = e && e.__esModule ? function () {
|
||||
return e["default"]
|
||||
} : function () {
|
||||
return e
|
||||
};
|
||||
return c.d(r, "a", r), r
|
||||
}, c.o = function (e, r) {
|
||||
return Object.prototype.hasOwnProperty.call(e, r)
|
||||
}, c.p = "";
|
||||
var l = window["webpackJsonp"] = window["webpackJsonp"] || [], a = l.push.bind(l);
|
||||
l.push = r, l = l.slice();
|
||||
for (var p = 0; p < l.length; p++) r(l[p]);
|
||||
var i = a;
|
||||
u.push([0, "chunk-vendors"]), t()
|
||||
})({
|
||||
0: function (e, r, t) {
|
||||
e.exports = t("56d7")
|
||||
}, "234a": function (e, r, t) {
|
||||
}, "56d7": function (e, r, t) {
|
||||
"use strict";
|
||||
t.r(r);
|
||||
t("e260"), t("e6cf"), t("cca6"), t("a79d");
|
||||
var n = t("7a23");
|
||||
|
||||
function o(e, r, t, o, u, c) {
|
||||
var l = Object(n["e"])("HelloWorld");
|
||||
return Object(n["d"])(), Object(n["b"])(l, {msg: "Welcome to Your Vue.js App"})
|
||||
}
|
||||
|
||||
var u = {class: "hello"};
|
||||
|
||||
function c(e, r, t, o, c, l) {
|
||||
return Object(n["d"])(), Object(n["b"])("div", u, [Object(n["c"])("h1", null, Object(n["f"])(t.msg), 1)])
|
||||
}
|
||||
|
||||
var l = {name: "HelloWorld", props: {msg: String}};
|
||||
l.render = c;
|
||||
var a = l, p = {name: "App", components: {HelloWorld: a}};
|
||||
t("e825");
|
||||
p.render = o;
|
||||
var i = p;
|
||||
Object(n["a"])(i).mount("#app")
|
||||
}, e825: function (e, r, t) {
|
||||
"use strict";
|
||||
t("234a")
|
||||
}
|
||||
});
|
||||
(function(e){function r(r){for(var n,c,l=r[0],a=r[1],p=r[2],f=0,s=[];f<l.length;f++)c=l[f],Object.prototype.hasOwnProperty.call(o,c)&&o[c]&&s.push(o[c][0]),o[c]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);i&&i(r);while(s.length)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=c(c.s=t[0]))}return e}var n={},o={vue_app_01:0},u=[];function c(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.m=e,c.c=n,c.d=function(e,r,t){c.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},c.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,r){if(1&r&&(e=c(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(c.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)c.d(t,n,function(r){return e[r]}.bind(null,n));return t},c.n=function(e){var r=e&&e.__esModule?function(){return e["default"]}:function(){return e};return c.d(r,"a",r),r},c.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},c.p="";var l=window["webpackJsonp"]=window["webpackJsonp"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var p=0;p<l.length;p++)r(l[p]);var i=a;u.push([0,"chunk-vendors"]),t()})({0:function(e,r,t){e.exports=t("56d7")},"234a":function(e,r,t){},"56d7":function(e,r,t){"use strict";t.r(r);t("e260"),t("e6cf"),t("cca6"),t("a79d");var n=t("7a23");function o(e,r,t,o,u,c){var l=Object(n["e"])("HelloWorld");return Object(n["d"])(),Object(n["b"])(l,{msg:"Welcome to Your Vue.js App"})}var u={class:"hello"};function c(e,r,t,o,c,l){return Object(n["d"])(),Object(n["b"])("div",u,[Object(n["c"])("h1",null,Object(n["f"])(t.msg),1)])}var l={name:"HelloWorld",props:{msg:String}};l.render=c;var a=l,p={name:"App",components:{HelloWorld:a}};t("e825");p.render=o;var i=p;Object(n["a"])(i).mount("#app")},e825:function(e,r,t){"use strict";t("234a")}});
|
@ -1 +1,15 @@
|
||||
{{ test }}
|
||||
{% load render_bundle from webpack_loader %}
|
||||
|
||||
|
||||
<div id="app">
|
||||
<app></app>
|
||||
</div>
|
||||
|
||||
{% render_bundle 'chunk-vendors' %}
|
||||
{% render_bundle 'vue_app_01' %}
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
</script>
|
@ -1,24 +0,0 @@
|
||||
# vue
|
||||
|
||||
## Project setup
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
yarn serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
yarn build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
@ -33,7 +33,9 @@
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"rules": {}
|
||||
"rules": {
|
||||
"no-unused-vars": "off"
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<HelloWorld msg="Welcome to Your Vue.js App"/>
|
||||
<HelloWorld msg="Test"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -1,15 +1,25 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
{{ text }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {myCustomTestFunction} from "@/utils";
|
||||
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
data() {
|
||||
return {
|
||||
text: ''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
msg: String
|
||||
},
|
||||
mounted() {
|
||||
this.text = myCustomTestFunction("Neuer Text")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
14
vue/src/components/TestComponent.vue
Normal file
14
vue/src/components/TestComponent.vue
Normal file
@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'TestComponent',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
3
vue/src/test.js
Normal file
3
vue/src/test.js
Normal file
@ -0,0 +1,3 @@
|
||||
export function myOtherTestFunction(n) {
|
||||
return n
|
||||
}
|
9
vue/src/utils.js
Normal file
9
vue/src/utils.js
Normal file
@ -0,0 +1,9 @@
|
||||
export {myOtherTestFunction} from './test.js'
|
||||
|
||||
import TestComponent from './components/TestComponent'
|
||||
|
||||
|
||||
export function myCustomTestFunction(x) {
|
||||
console.log(x)
|
||||
return x
|
||||
}
|
@ -5,6 +5,10 @@ const pages = {
|
||||
entry: './src/main.js',
|
||||
chunks: ['chunk-vendors']
|
||||
},
|
||||
'util': {
|
||||
entry: './src/utils.js',
|
||||
chunks: ['chunk-vendors']
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -1 +1 @@
|
||||
{"status":"done","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"vue_app_01":[{"name":"css/vue_app_01.css","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\css\\vue_app_01.css"},{"name":"js/vue_app_01.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\vue_app_01.js"}]}}
|
||||
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"util":[{"name":"js/util.js","publicPath":"http://localhost:8080/js/util.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\util.js"}],"vue_app_01":[{"name":"js/vue_app_01.js","publicPath":"http://localhost:8080/js/vue_app_01.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\vue_app_01.js"},{"name":"vue_app_01.3d20274fdb25a102c86d.hot-update.js","publicPath":"http://localhost:8080/vue_app_01.3d20274fdb25a102c86d.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\vue_app_01.3d20274fdb25a102c86d.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/eslint-loader/index.js):\n\nF:\\Developement\\Django\\recipes\\vue\\src\\components\\HelloWorld.vue\n 17:5 error Unexpected mutation of \"msg\" prop vue/no-mutating-props\n\n✖ 1 problem (1 error, 0 warnings)\n"}
|
Loading…
Reference in New Issue
Block a user